Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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 text with today date.
Date.ToText(Date.From(DateTime.LocalNow()))
Here is what I tried to replace with last week date, but failed
Date.AddDays(Date.From(DateTime.LocalNow())),-7)
Solved! Go to Solution.
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.
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.
I think you have an extra ')' in your new line.
Date.ToText(Date.AddDays(Date.From(DateTime.LocalNow())),-7)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.