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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
NPC
Helper I
Helper I

Custom Weeknum

Hello,

 

I'm trying to create a column with custom week numbers (Operating periods) that end in the dates below:

 

1/1/2022 - 1/12/2022  - Week 1

1/13/2022 - 1/19/2022  - Week 2
1/20/2022 - 1/26/2022 - Week 3

Until the last week of the year. 


Any ideas on how I can accomplish this? I a pprecite your help!

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @NPC 

 

Create a new column with below DAX

Column = 
var __days = DATEDIFF("2022-1-5",Dates[Date],DAY)
var __customWeekNum = IF(__days>0,ROUNDUP(__days/7,0),1)
return
"Week " & __customWeekNum

22011302.jpg

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @NPC 

 

Create a new column with below DAX

Column = 
var __days = DATEDIFF("2022-1-5",Dates[Date],DAY)
var __customWeekNum = IF(__days>0,ROUNDUP(__days/7,0),1)
return
"Week " & __customWeekNum

22011302.jpg

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

This works. Thank you!

amitchandak
Super User
Super User

@NPC , You can get Thrusday to Wednesday week here

Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...

 

You need to have additional condition for first week

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.