Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Sorting by Specific Columns in Matrix

Hi,

 

If I remember correctly, Excel let's me sort a pivot table using each individual column. However, I haven't been able to figure out how to do that with Power BI. It only let's me sort by the total column. Has anyone had a different experience or know a workaround?

 

  • Anonymous okay, some positive news.  You can sort by columns, however, you need to create measures for each specific column that you want in your Matrix.  So, for example, in this instance, you have months Jan 2022, Feb 2022, March 2022 and April 2022.  To achieve the sorting, you would need to create measures for each one.  It's not ideal but it's one way of achieving a workaround:

     

    Jan 2022 = CALCULATE ( SUM ( 'Table'[Amount] ) , FILTER ( 'Date' , 'Date'[Mmm YYYY] = "Jan 2022" ) )
    Feb 2022 = CALCULATE ( SUM ( 'Table'[Amount] ) , FILTER ( 'Date' , 'Date'[Mmm YYYY] = "Feb 2022" ) )
    Mar 2022 = CALCULATE ( SUM ( 'Table'[Amount] ) , FILTER ( 'Date' , 'Date'[Mmm YYYY] = "Mar 2022" ) )
    Apr 2022 = CALCULATE ( SUM ( 'Table'[Amount] ) , FILTER ( 'Date' , 'Date'[Mmm YYYY] = "Apr 2022" ) )

    Just change the [Mmm YYYY] column to whatever identifies the specific month in your Date table and similarly change the "Jan 2022" etc to whatever the specific naming convention is that you have in your Date table as well.

     

    Again, not the ideal solution but gives you what you are after. Just add the measures as values in your Matrix table and do not add anything in the "columns".

     

    All the best.

    Theo

     

8 Replies