Forum Discussion
My X axis date column in weeks
- 1 year ago
Create a Week Start Date (Monday)
WeekStartDate =
'Date'[Date] - WEEKDAY('Date'[Date], 2) + 1
-This ensures every date maps to the Monday of its week.
-WEEKDAY(..., 2) makes Monday = 1, Sunday = 72. Generate a Sortable Week Index Across Years
WeekIndex =
YEAR('Date'[WeekStartDate]) * 100 + WEEKNUM('Date'[WeekStartDate], 2)
- This gives you values like 202401, 202402, etc.
- Ensures proper chronological sorting across years.3. Create Display Format: WeekNo (Month)
WeekLabel =
"W" & WEEKNUM('Date'[WeekStartDate], 2) & " (" & FORMAT('Date'[WeekStartDate], "MMM") & ")"- Example: W32 (Aug)
4. Sort the Display Column by WeekIndex
In Power BI:
- Go to the WeekLabel column.
- Use "Sort by Column" → select WeekIndex.
Hi asheyashey
Adding on to the same concept mentioned by rohit1991
Have 2 columns
Week Start = 'Date'[Date] - WEEKDAY('Date'[Date], 2) + 1
YearWeek = YEAR('Date'[Week Start]) & FORMAT(WEEKNUM('Date'[Week Start], 2), "00")
Within the X Axis use the label:
Week Label = "Week " & FORMAT(WEEKNUM('Date'[Week Start], 2), "00") & " (" & FORMAT('Date'[Week Start], "mmm dd") & ")"
Make sure to do the sort either in the visual or within the model pane by selecting the column and sort it by the other.
- asheyashey1 year ago
Helper I
Thank you for reply.
Helped a lot