Forum Discussion
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.
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/599712
9 Replies
- amitchandakSuper User
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/- SpiroswayGRResolver III
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 ?
Thanks in advance!!!
- amitchandakSuper User
- Greg_DecklerCommunity Champion
Check out Sequential - https://community.powerbi.com/t5/Quick-Measures-Gallery/Sequential/m-p/380231#M116
- SpiroswayGRResolver III
Greg_Deckler Looks like that i need sequential solution.
With this calendar table is possible to create sequential measure / column ?
- Greg_DecklerCommunity ChampionSpiroswayGR Yes, just start by creating columns for Year=YEAR([Date]) and Week=WEEKNUM([Date])