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

View all the Fabric Data Days sessions on demand. View schedule

Reply
patrickessa
Regular Visitor

Custom week of month in date table

Hello, I've created a date table in an attempt to create a Year/Month/Week/Date Hierarchy. The problem I have is with the weeks, of course...

 

In every other Q&A that I've studied on the forum, the solution works on the framework of days-of-the-week, i.e. Sunday through Saturday, or Monday through Sunday. 

 

But I need a week number column based on the day of the month (i.e. take whichever number it is, 1-31, divided by 7 days in a week, to give a result somewhere between 1-5). For example, days 1-7 would always give a result = 1, days 8-14 would always give result = 2, etc.

 

Here's what I mean, the two real columns are the ones I've managed to create, and the far-right column with red text ("WeekNum") is what I actually want a DAX formula to do:

 

Screen Shot 2018-05-14 at 5.30.14 PM.png

 

Thanks in advance!

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @patrickessa

 

Does this do what you want?

 

Column = INT((DAY([Date])-1)/7)+1

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @patrickessa

 

Does this do what you want?

 

Column = INT((DAY([Date])-1)/7)+1

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks @Phil_Seamark

PS, don't try and create a YEAR/MONTH/WEEK hierarchy.  They just don't work well together.

 

Create a YEAR/MONTH, or a YEAR/WEEK - but in the later case make sure the YEAR aligns with your first/last weeks


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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