Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Weeks (52-53) over multiple years.

Weeks 52 and 53 have the potential to be spilt over 2 calender years.   Week 52 for example starts on 27th December 2021 and ends on the 2nd of January 2022.   Hence when i use Week Number as a x...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

    I updated your sample pbix file(see attachment), please check whether that is what you want.

    1. Create a calculated column as below in Calendar table

    YearWeek = 
    VAR _week =
        IF (
            'Calendar'[WEEKOFYEAR] < 10,
            "0" & 'Calendar'[WEEKOFYEAR],
            'Calendar'[WEEKOFYEAR]
        )
    RETURN
        IF (
            'Calendar'[MONTH] = 1
                && 'Calendar'[WEEKOFYEAR] > 50,
            ( 'Calendar'[YEAR] - 1 ) & _week,
            'Calendar'[YEAR] & _week
        )

    2. Replace the field "WEEKOFYEAR" in X axis of chart with the new calculated column just as shown in below screenshot

    Best Regards