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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
HenryJS
Post Prodigy
Post Prodigy

Custom Week Number Column

Hi all,

 

How can I create a Week Number column from a date column I have in my data?

 

I want the below data range to be 'Week 1' and so on...

 

10/04/20 00:00:00 - 17/04/2020 00:00:00 - WEEK 1

 

Thanks,

2 ACCEPTED SOLUTIONS
jdbuchanan71
Super User
Super User

There is a week number function in DAX that should work for you.

 

Column = 
VAR _Wk = WEEKNUM ( DATES[Date] )
RETURN
"week " & _Wk

View solution in original post

v-eachen-msft
Community Support
Community Support

Hi @HenryJS ,

 

You could refer to the following codes in query editor.

= "WEEK " & Number.ToText(Date.WeekOfYear([Column1]))

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

6 REPLIES 6
v-eachen-msft
Community Support
Community Support

Hi @HenryJS ,

 

You could refer to the following codes in query editor.

= "WEEK " & Number.ToText(Date.WeekOfYear([Column1]))

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

@HenryJS , you can do like.

 

replace the startofyear('Date'[Date]) with starting date you want

 

Week Start With Year=  QUOTIENT(DATEDIFF(STARTOFYEAR('Date'[Date]),'Date'[Date],DAY),7)+1 

Week Start Date with Year = var _1 =QUOTIENT(DATEDIFF(STARTOFYEAR('Date'[Date]),'Date'[Date],DAY),7) return STARTOFYEAR('Date'[Date]) + if(_1<52,_1,51)*7

 

 

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
jdbuchanan71
Super User
Super User

There is a week number function in DAX that should work for you.

 

Column = 
VAR _Wk = WEEKNUM ( DATES[Date] )
RETURN
"week " & _Wk
ryan_mayu
Super User
Super User

@HenryJS 

 

I have some questions

1.  There are 8 days from day 10 to day 17. Do you want each custom week has 8 days?

2. how to stop the week? If you don't set up the terminal day. The week number will continue growing.

 

Column = 
VAR week="week"&ROUNDUP(('Table'[Date]-date(2020,4,10)+1)/7,0)
return if('Table'[Date]<date(2020,4,10),blank(),week)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




how do the weeks stop? when you reach December 31 I should stop.

@Syndicate_Admin 

it  looks like the fiscal year and calendar year are the same. then you can use WEEKNUM function





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

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.