Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi, I have an issue with my Year Week expression whenever there is a new year. When looking at weekly aggregated data I would like entire week 52 to be counted into year 2021, although the ending of week 52 is in the next year.
This is my current code:
Calendar = ADDCOLUMNS (
CALENDAR (DATE(2016,1,1),TODAY()),
"Week", CONCATENATE(CONCATENATE(FORMAT([Date], "yyyy"), " W"),Format(WEEKNUM([Date], 21), "00"))
)
And this is my regions calendar layout (In DAX format: 21)
Date | Current outcome (Year Week) | Desired outcome (Year Week) |
30 dec 2021 | 2021 W52 | 2021 W52 |
31 dec 2021 | 2021 W52 | 2021 W52 |
1 jan 2022 | 2022 W52 | 2021 W52 |
2 jan 2022 | 2022 W52 | 2021 W52 |
3 jan 2022 | 2022 W01 | 2022 W01 |
Solved! Go to Solution.
@Anonymous , Take the year from week's start date
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Year Week = year([Week Start Date]) * 100 + [Your Week Number column]
Use below formula for your calendar
Calendar = ADDCOLUMNS (
CALENDAR (DATE(2016,1,1),TODAY()),
"Week", CONCATENATE(CONCATENATE(FORMAT([Date]+1-WEEKDAY([Date]-1), "yyyy"), " W"),Format(WEEKNUM([Date], 21), "00"))
)
Use below formula for your calendar
Calendar = ADDCOLUMNS (
CALENDAR (DATE(2016,1,1),TODAY()),
"Week", CONCATENATE(CONCATENATE(FORMAT([Date]+1-WEEKDAY([Date]-1), "yyyy"), " W"),Format(WEEKNUM([Date], 21), "00"))
)
@Anonymous , Take the year from week's start date
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Year Week = year([Week Start Date]) * 100 + [Your Week Number column]
User | Count |
---|---|
48 | |
41 | |
19 | |
14 | |
13 |
User | Count |
---|---|
102 | |
55 | |
28 | |
19 | |
14 |