Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
How can I get last Friday date in a Custom Column of Power Query please?
Today is 28/07/2021 so last Friday date was 23/07/2021.
Thanks
Solved! Go to Solution.
Found a solution on Desktop forum:
Date.AddDays(Date.From(DateTime.LocalNow()),-Date.DayOfWeek(Date.From(DateTime.LocalNow()),5))
Found a solution on Desktop forum:
Date.AddDays(Date.From(DateTime.LocalNow()),-Date.DayOfWeek(Date.From(DateTime.LocalNow()),5))
Here is one way to do it in a custom column.
= if Date.DayOfWeek([Date]) >= 5 then Date.AddDays(Date.StartOfWeek([Date]), 5) else Date.AddDays(Date.StartOfWeek([Date]), -2)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
= Date.StartOfWeek(Date.From(DateTime.LocalNow())) - #duration(2,0,0,0)
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@CNENFRNL thanks but not what I wanted.
This is giving me date of 2 days ago i.e. 24/07/2021 which was Saturday. Can it be dynamic to calculate from any date what was last Friday date?
Thanks
And here is another way.
= List.Max(List.Select(List.Dates(Date.AddDays([Date], -6),7,#duration(1,0,0,0)), each Date.DayOfWeek(_) = 5))
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |