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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
hxkresl
Helper V
Helper V

Need to calculate the week-ending dates for the complete year.

In my Date (or calendar) table I need a column having the week ending dates on Friday.

 

Similar to Excel:

 

https://excel.tips.net/T002444_Calculating_Week-Ending_Dates.html 

 

If someone has previously solved/pls share link.

1 ACCEPTED SOLUTION
Hasan
Resolver I
Resolver I

I have used this formula before and it worked for me

 

Weekend = 'Calendar'[DT]-MOD('Calendar'[DT]-1,7)+5

 

 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

The weekending calculations here are WRONG!

I wanted to get a weekending of Friday. So for me my week was from Sat 00:00 to Fri 23:59. This is the RIGHT formula for it

 

Week_Ending6 = [creation_date] - MOD([creation_date]+0|7)+6

Hasan
Resolver I
Resolver I

I have used this formula before and it worked for me

 

Weekend = 'Calendar'[DT]-MOD('Calendar'[DT]-1,7)+5

 

 

@Hasan Thank you for the great solution!

I used your formula to calculate my week ending for Thursdays, however in some cases the week ending date is before the completion date:

 

MG_WeekEnding = 'MG_WIP'[CompletionDate]-MOD('MG_WIP'[CompletionDate]-1,7)+4

HI There,

 

I played around with dummy data and i found this:

 

If completion date is Friday, with this formula week ending will be last thursday. I think you need to decide if you want to roll over Friday to next week or the current actual week

 

Capture.JPG

I have used this to calculate my week ending on Thursdays, however sometimes the calculated week ending date is before the completion date:

 

MG_WeekEnding = 'MG_WIP'[CompletionDate]-MOD('MG_WIP'[CompletionDate]-1,7)+4

@Hasan  that's working well.

 

 

Thanks.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.