Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Remon1991
Frequent Visitor

Last friday date and time

Hi,

 

How can I get last Friday date and every hour in a Custom Column of Power Query please?

Today is 01/05/2024 so last Friday date was 26/04/2024.

I have a column with date and time with every hour where i much look at.

 

I now use Date.AddDays(DateTime.From(DateTime.LocalNow()),-Date.DayOfWeek(DateTime.From(DateTime.LocalNow()),5)))

But then it looks at last friday with actual time stamp.

Thanks

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

Not sure exactly what you want since you don't show an example of your desired results, and your explanation is not clear to me, but for last friday as a DateTime:

 

lastFriday = Date.StartOfWeek(DateTime.FixedLocalNow(),Day.Friday)

=> 4/26/2024 12:00:00 AM

 

 

And for all the hours of last friday:

 

   lastFriday = Date.StartOfWeek(DateTime.FixedLocalNow(),Day.Friday),
   AllHours = List.DateTimes(lastFriday,24,#duration(0,1,0,0))

ronrsnfld_0-1714560077044.png

...

ronrsnfld_1-1714560122724.png

 

 

 

 

View solution in original post

2 REPLIES 2
Remon1991
Frequent Visitor

Hi, 

 

That is exactly what i need thank you 😊

ronrsnfld
Super User
Super User

Not sure exactly what you want since you don't show an example of your desired results, and your explanation is not clear to me, but for last friday as a DateTime:

 

lastFriday = Date.StartOfWeek(DateTime.FixedLocalNow(),Day.Friday)

=> 4/26/2024 12:00:00 AM

 

 

And for all the hours of last friday:

 

   lastFriday = Date.StartOfWeek(DateTime.FixedLocalNow(),Day.Friday),
   AllHours = List.DateTimes(lastFriday,24,#duration(0,1,0,0))

ronrsnfld_0-1714560077044.png

...

ronrsnfld_1-1714560122724.png

 

 

 

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.