Forum Discussion

larx_mandel's avatar
larx_mandel
Frequent Visitor
1 year ago
Solved

Matrix order with Date hierarchy

Hi community,

 

I have  matrix table with a Date in a form of hierarchy (Year, Month). In our configuration months are displayed as text.

I create a measure that calculates previous year data:

 

M_PreviousYearData =
CALCULATE(
    SUM(Sales),
    SAMEPERIODLASTYEAR(_mydataset[Date].[Date])
)
 
My table looks like:
 
YearMonthM_PreviousYearData
2024January20
2024February25
...  
2024November50
2024December80
2023January15
2023February40
....  
 
I want to order by Year descending, and then by Month, but matrix only allow to order by Year or Month. If I tried to add a Period to my table, and order by it then my measure stop working, returning BLANK.
 
How can I order to obtain a table like:
YearMonthM_PreviousYearData
2024December80
2024November50
...  
2023December60
2023November30
...  

 

Thanks for your help.

Regards.

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Click on the Year column, then after it is sorted by year, hold down the Shift key and click on the Month column

  • larx_mandel's avatar
    larx_mandel
    Frequent Visitor

    I tried with Shift key but it is not working. It is ordering separately.

    My Power BI version is Version: 2.139.1678.0 64-bit (january 2025).

    Thanks.