Forum Discussion

naoyixue1's avatar
naoyixue1
Icon for Post Patron rankPost Patron
3 years ago
Solved

How to replace the text with last week date in Power Query

Hey! I'm now trying to replace the text with last week date in power query, but failed. (see below exact changes I made)   Any thoughts? Thanks!   That's what I originally used to replace the...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi naoyixue1 ,

     

    I think -7 should in Date.AddDays function. Please try code as below.

    = Table.ReplaceValue(#"Filtered Rows3","Past",Date.ToText(Date.AddDays(Date.From(DateTime.LocalNow()),-7)),Replacer.ReplaceValue,{"Week"})

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.