Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
quynhttk
Frequent Visitor

How to Sort Data in Power BI Matrix by Multiple Conditions

I have raw data as follows

quynhttk_0-1734685620995.png

Then I use power bi and use Matrix to drag the table as follows. However, I want to sort by the following 2 conditions:
1. Sort by year from smallest to largest
2. In each year, revenue by product is sorted from largest to smallest revenue.
I can only sort by 1 condition, I cannot combine both conditions.

quynhttk_3-1734685746970.png

This is the result I want

quynhttk_2-1734685683767.png

Please help me!

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Matrix can only be sorted either by value or by category. In your case, you can sort by the field in the second level of the row hierarchy.

danextian_0-1734687011002.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
JustSayJoe
Advocate IV
Advocate IV

Step 1: In your Matrix, add a field to the row hierarchy (which you will later remove).

Step 2: Change the Matrix to a Table visual.

Step 3: Sort all the columns you wish to sort, and in the order you wish them to be sorted.

Step 4: Delete the field you previously added in Step 1 from the table.

Step 5: Change the Table back to a Matrix visual.

Step 6: Ensure the right fields are back in the Row hierarchy.

 

This will maintain your multiple sorted fields within your matrix, even when you expand your row hierarchies.

danextian
Super User
Super User

Matrix can only be sorted either by value or by category. In your case, you can sort by the field in the second level of the row hierarchy.

danextian_0-1734687011002.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.