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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dedelman_clng
Community Champion
Community Champion

Date.WeekOfMonth to start on Monday?

Is there a switch for the PowerQuery/M function Date.WeekOfMonth that will tell it that a week is Monday-Sunday instead of Sunday-Saturday?

 

I know I can do it with an IF statement based on the day of the week - just wondering if the function has the capability.

 

Thanks

David

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Yes, just change the start day parameter:

 

Date.WeekOfMonth(dateTime as any, optional firstDayOfWeek as nullable number) as nullable number  

 

Use Day.Monday for the FirstDayOfWeek parameter.

 

Many of the date functions, especially the Week functions, have this. They assume Day.Sunday I think, but you can easily change that to any day of the week.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
dedelman_clng
Community Champion
Community Champion

Thanks @edhans - I initially didn't see the option come up in the editor. 

David

I've often seen parameters fail to show up until you hit the comma before that parameter, and if you don't know to look for it with a comma....

I wouldn't rely on Intellisense in PQ to help in the same way it does in DAX or in Excel. It isn't quite at that level.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
edhans
Super User
Super User

Yes, just change the start day parameter:

 

Date.WeekOfMonth(dateTime as any, optional firstDayOfWeek as nullable number) as nullable number  

 

Use Day.Monday for the FirstDayOfWeek parameter.

 

Many of the date functions, especially the Week functions, have this. They assume Day.Sunday I think, but you can easily change that to any day of the week.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors