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
bernate
Helper III
Helper III

Creating Week Range With Leading 0's

Hello, I am trying to create a week range column in my date table. I got the start and end date columns in Power Query, changed their format to mm/dd/yyyy in Table view, and concatenated them but the leading 0's didn't stay.

bernate_2-1705699485000.png

 

I want the Week Range to show 01/02/2024-01/07/2024 so that when the column is sorted in a visual the week ranges are in the correct order by date. I also tried to sort the Week Range column by a date column and that didn't work because I have repeating values in the Week Range column. 

bernate_1-1705699435964.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

If you are OK with a DAX solution, then write this calculated column formula

Week range = format(Data[Start of week],"mm/dd/yyyy")&"-"&format(Data[End of week],"mm/dd/yyyy")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @bernate ,

Below is my table:

vxiandatmsft_0-1705908653784.png

The following DAX might work for you:

Week Range = COMBINEVALUES("-",FORMAT('Table'[StartOfWeek],"mm/dd/yyyy"),FORMAT('Table'[EndOfWeek],"mm/dd/yyyy"))

The final output is shown in the following figure:

vxiandatmsft_1-1705908693758.png

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

If you are OK with a DAX solution, then write this calculated column formula

Week range = format(Data[Start of week],"mm/dd/yyyy")&"-"&format(Data[End of week],"mm/dd/yyyy")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Worked perfectly, thank you for your help!

Daniel29195
Super User
Super User

hello @bernate 

for leading zero, can you please change mm to MM. 

 

for the ordering ,

i would suggest to create a start of week column, and sort the week range by this column. 

 

let me know if this would help you . 

 

best regards

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.