Forum Discussion

bmk's avatar
bmk
Helper II
3 years ago
Solved

DAX Date Table : Week Range - Sorting issue

Hello,   I'm using the below given Date Table in my report (open to suggestions to optimize/tweak if needed). I am currently using Date, Month, Week Range as the drill down heirarchy.   The Date ...
  • v-yinliw-msft's avatar
    3 years ago

    Hi bmk ,

     

    This error is because the column which used to sort the other column need to be the unique, the error is here (In my PBIX file, it can be seen in the ERRORHERE Table):

     

    So we can do a little change to the column Weeknum,

    New a column:

     

    Index =
    IF (
        'Date Table'[Date] >= DATE ( 2021, 12, 27 )
            && 'Date Table'[Date] <= DATE ( 2022, 1, 2 ),
        152,
        ( YEAR ( 'Date Table'[Date] ) - 2020 ) * 100 + 'Date Table'[WeekNum]
    )
    

     

    You can sort by the Index column.

     

    The result is:

     

     

    Here is my PBIX file.

    Hope this helps you.

     

    Best Regards,

    Community Support Team _Yinliw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.