Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to sort column in Matrix ?

Hi All,

 

I am struggling to sort the column in my matrix visual as you can see in below SS-1 there is column sort by alphabetically PQTD, PYTD, QTD, YTD but I want to sort column like this QTD,PQTD,YTD,PYTD

I have also created a helper column to sort matrix column by using this field I can sort but sorting not flowing my matrix visual

Need your help is there any other way sort column so that I can sort the column in matrix visual to get my desire output QTD,PQTD,YTD,PYTD ?

 

 

 

SortPeriod = SWITCH(TRUE(),'Report Period'[Period]="QTD",1,'Report Period'[Period]="PQTD",2,'Report Period'[Period]="YTD",3,'Report Period'[Period]="PYTD",4)

 

 

 

SS-1

SS-2

Thanks

Lavdeep

  • Hi Anonymous ,

     

    First create a new column as below: (to avoid a circular dependency error)

     

    _Period = 'Report Period'[Period]

     

    Then select the column>sort by column>SortPeriod:

    And you will see:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!

     

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak  Thanks for reply 

      I Just go through the link shared your article not relevant because I am using the latest version of power bi desktop where the sort by column option not showing under the modeling tab I just sort additional helper field from data view (Select field +Right Click+ Sort) it works in data view but changes not flowing in visual it remain same alphabetically

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , Can you share a sample pbix after removing sensitive data.