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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
vacacelaivan
Frequent Visitor

Need Help with Custom Week of month number

Hi all, I've been trying to get around this problem with no luck.

 

Trying to create a column for the week number of the month, with the week always starting on Monday and ending on a Sunday. 

Months will have 4 or 5 weeks

 

The below DAX almost works: 

 

weekinmonth = 1 + WEEKNUM ( Dates[Date],21)-WEEKNUM( STARTOFMONTH (Dates[Date]),21)

 

 

However, if the month does not end on a Sunday, the week number changes back to 1 in the middle of the week which is incorrect.

I was unable to upload a screenshot at work, but in the example below Feb 01 - 04 (in red) should be in Week 5, while Monday Feb 05 should be week 1 (in blue).

 

DateWeek of Month
Monday, Jan 22, 20184
Tuesday, Jan 23, 20184
Wednesday, Jan 24, 20184
Thursday, Jan 25, 20184
Friday, Jan 26, 20184
Saturday, Jan 27, 20184
Sunday, Jan 28, 20184
Monday, Jan 29, 20185
Tuesday, Jan 30, 20185
Wednesday, Jan 31, 20185
Thursday, Feb 01, 20181
Friday, Feb 02, 20181
Saturday, Feb 03, 20181
Sunday, Feb 04, 20181
Monday, Feb 05, 20182

 

Any help on this is extremely appreciated.

Ivan

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @vacacelaivan,

 

Based on my test, it is not possible to meet your requirement currently. You can come up a new idea about that and add your comments there to improve Power BI and make this feature coming sooner.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @vacacelaivan,

 

Based on my test, it is not possible to meet your requirement currently. You can come up a new idea about that and add your comments there to improve Power BI and make this feature coming sooner.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
abbasabdulla
Frequent Visitor

Hi,

Does changing 21 to 2 in your function solve this? Why you put the 21?

 

weekinmonth = 1 + WEEKNUM ( Dates[Date],2)-WEEKNUM( STARTOFMONTH (Dates[Date]),2)

I tried both methods WEEKNUM (Date, 2) and WEEKNUM (DATE, 21), but both don't work in this case.

The parameter 21 is to return weeknumbers according to ISO 8601.http://blog.gbrueckl.at/2012/04/iso-8601-week-in-dax/ and a number of other articles in this forum.

 

Bump?!?

Try using this function

= 1 + WEEKNUM ( Dates[Date],2)-WEEKNUM( DATE(YEAR(Dates[Date]),MONTH(Dates[Date]),1),2)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors