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
SpiroswayGR
Resolver III
Resolver III

Custom Week Number for specific Date Range

Dear Community,

 

I would like to create a weeknumber for specific date range in 2 years :

Example : 

Start Date : 01/06/2019 to End Date : 05/11/2020

01/06/2019 to 07/06/2019 is Week1 

08/06/2019 to 15/06/2019 is Week 2 

......

XX/XX/2020 to XX/XX/2020 Week 145

 

My purpose is to create a weekly LINE chart on these specific dates for CY and LY (for same dates but 01/06/2018 to 05/011/2019).

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Like

Week = format([Week Start date],"dd/mm/YYYY") & " to "& format([Week End date],"dd/mm/YYYY")

 

If you need set that as date format : https://community.powerbi.com/t5/Desktop/How-to-apply-UK-date-format-dd-mm-yyyy-in-Date-slicer/td-p/...

 

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

View solution in original post

9 REPLIES 9
Greg_Deckler
Community Champion
Community Champion

Check out Sequential - https://community.powerbi.com/t5/Quick-Measures-Gallery/Sequential/m-p/380231#M116

 



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...

@Greg_Deckler  Looks like that i need sequential solution.

 

 

With this calendar table is possible to create sequential measure / column ? 

https://prnt.sc/rh5gg4

 

@SpiroswayGR Yes, just start by creating columns for Year=YEAR([Date]) and Week=WEEKNUM([Date])


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...
amitchandak
Super User
Super User

@SpiroswayGR 

Create in your date table like

 

Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date])+1
Week End date = DATEADD('Date'[Date],7-1*WEEKDAY('Date'[Date]),DAY)

Week = [Week Start date] & " to "& [Week End date]

 

 

Also refer : https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0

use format on dates if needed

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

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

@amitchandak  Thank you for your effort.

 

There is a small progress but still not completed. These weeks are not sorted on my graph.

 

So is there any week to sort it with correct dates ? 

https://prnt.sc/rh5d73

 

Thanks in advance!!!

 

@SpiroswayGR , create week start as your sort column

 

Sort_by_column.pngSortnewribbion.png

 

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

@amitchandak  Thanks very much!!

 

Almost complete my solution but still 2 remaining things...

1st : Is it possible to show dates as "DD/MM/YYYY" instead of "MM/DD/YYYY"?

https://prnt.sc/rh6heo

2nd : Is it possible to visualize on same weekly graph metrics for this week year and metrics for Last week year ? 

for example : Week for this year : 10/02/2019 to 17/02/2019 with Sum metric = 1000 and last year metric : 10/02/2018 to 17/02/2019 with sum metric : 500

 

Thanks again!!

 

Like

Week = format([Week Start date],"dd/mm/YYYY") & " to "& format([Week End date],"dd/mm/YYYY")

 

If you need set that as date format : https://community.powerbi.com/t5/Desktop/How-to-apply-UK-date-format-dd-mm-yyyy-in-Date-slicer/td-p/...

 

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

@amitchandak 

Thanks very much.

 

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 Fabric 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.