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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

 

View solution in original post

9 REPLIES 9
Greg_Deckler
Super User
Super User

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

 


@ 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!:
The Definitive Guide to Power Query (M)

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])

@ 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!:
The Definitive Guide to Power Query (M)

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/

 

@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

 

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

 

@amitchandak 

Thanks very much.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.