Forum Discussion

ashwinkolte's avatar
ashwinkolte
Helper III
8 months ago
Solved

Need help in sorting with a Matrix visual

Hi

I have a Matrix visual in my Power BI report ( just fyi for mimicking a Gantt chart) .

The matrix has following "Rows" fields

1) Client
2) No of Go-Lives
3) Duration of Go-Live
4) Project duration
5) Latest Go-Live Date

 

The "Columns" field of the matrix has Year-month field. It spans 3-4 years . One column for each month

 

The "Values" field has a measure which populates each cell in the values section

 

The issue I am facing is sorting . As this is a matrix visual, sorting is possible for the field in the higehest hierarchy .. i.e "Client" in this case

 

However I want to be able to sort using any other field as well from the "Rows" fields given above

Is there a solution/work around for this . Please note - I dont want a solution which requires to add any additional field to values section becuase it will create a additional column for every year-month column

 

Thanks in advance

Ashwin Kolte

  • Hi there,

    In a Power BI Matrix, you cannot directly sort by fields in lower levels of a hierarchy from the UI. The official solution is to use Sort by Column:

    Add a calculated column (or a column in your table) that contains the sort order for the field you want to sort.

    Select the field in the Rows → go to Column tools → Sort by column → choose the new sort column.

    This allows you to sort any row field without adding it to the Values section.

    Official Microsoft Reference:

    Power BI: Sort a column by another column


    Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

    Regards,
    Rufyda Rahma | Microsoft MIE 



9 Replies

  • ashwinkolte , Put all these fields in field parameters.  Use that on the Matrix Row. Sort visual on the Row column.  And now the end use can select one or more field in order they want to sort  with CTRL+CLick on Field parameter slicer

    Check Page 34 of attached file after Signature  

    I selected Category first 



    With the field parameter's new sort feature, it should work


    Persisted sorting for field parameters
    https://www.youtube.com/watch?v=Gd_4EwUwHbw&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1

  • ashwinkolte 

     

    Use field parameters to let users switch the top-level sort field dynamically.

     

    Another approach is building separate matrix visuals sorted by different fields and toggle visibility with slicers/bookmarks.

     

    If this answer helped, please click Kudos or Accept as Solution.
    -Kedar
    LinkedIn: https://www.linkedin.com/in/kedar-pande

  • Hi Amit 

     

    Thanks for quick response . Really appreciate it . Still its not working . Maybe I am doing somehting wrong hence wanted to check the PBIX file , but its not opening saiying it has some custom calender not supported in my system .

     

    Can you elaborate the steps a little bit 

      • ashwinkolte's avatar
        ashwinkolte
        Helper III

        Hi Amit , I saw the file . Thankyou so much for sharing . Since a slicer is used , it removes all other fields when any one is selected (e.g category, sub category, brand etc ) . My requirement is that all "Rows" fields should be visible and it should sort the entire table based on the field selected/desrired  . Is this possible 

  • Hi there,

    In a Power BI Matrix, you cannot directly sort by fields in lower levels of a hierarchy from the UI. The official solution is to use Sort by Column:

    Add a calculated column (or a column in your table) that contains the sort order for the field you want to sort.

    Select the field in the Rows → go to Column tools → Sort by column → choose the new sort column.

    This allows you to sort any row field without adding it to the Values section.

    Official Microsoft Reference:

    Power BI: Sort a column by another column


    Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

    Regards,
    Rufyda Rahma | Microsoft MIE 



  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hi ashwinkolte,

    Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to Rufydaamitchandak & Kedar_Pande for sharing valuable insights.

     

    Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.

     

    Thank you for being part of the Microsoft Fabric Community.

  • v-ssriganesh's avatar
    v-ssriganesh
    Community Support

    Hello ashwinkolte,

    Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.

    Thank you.