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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
NPC
Helper I
Helper I

To close the loop on this, this is what ended up working:

 

Operating Period = WEEKNUM('Calendar'[Date]+4, 21)-1

 

It gave me this: 

NPC_0-1642027429212.png

 

To correct the first 5 days of the week that defaulted to Operating Period 0, I added this:

 

Operating Periods = if('Calendar'[Operating Period] = 0,1,WEEKNUM('Calendar'[Date]+4, 21)-1)

 

The result was this, which is what I needed:

NPC_1-1642027622608.png

 



View solution in original post

3 REPLIES 3
NPC
Helper I
Helper I

To close the loop on this, this is what ended up working:

 

Operating Period = WEEKNUM('Calendar'[Date]+4, 21)-1

 

It gave me this: 

NPC_0-1642027429212.png

 

To correct the first 5 days of the week that defaulted to Operating Period 0, I added this:

 

Operating Periods = if('Calendar'[Operating Period] = 0,1,WEEKNUM('Calendar'[Date]+4, 21)-1)

 

The result was this, which is what I needed:

NPC_1-1642027622608.png

 



Greg_Deckler
Community Champion
Community Champion

@NPC What is the pattern? Is the first week 1/1 - 1/12 and then each week is the next 7 days? You could do something like maybe: WEEKNUM([Date],14) ? 14 starts weeks on Thursday.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Unfortunatley with this approach week 1 ends on 1/5. To answer your question though, yes - each week is the next 7 days after the first 12 days of the year.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.