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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Krcmajster
Helper IV
Helper IV

Sort Matrix table based on row that is not on top

I have a matrix visual that contains ID,Region,Country,City as rows (to get the Freeze columns effect of Excel). This is the order client wants. However he wants matrix to be sorted by city, which currently does not work if I Sort by it. If I move the City to top of the rows then it is fine. 
Is there a way to sort the visual based on other values that are in the row?  I need to use matrix visual because I can't mimic freeze columns from excel with simple table visual 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Krcmajster 

Matrix visual currently could only be sort by the first row.

So sort by City column makes no sense when your City column is not the the first column in matrix row.

You can try my way, sort your ID column by City column and then sort your matrix by ID.

Your ID column is the first row, it will work.

My Sample:

1.png

Select ID in Fields and sort ID by City in Column Tools.

2.png

Build a Matrix.

5.png

Sort Matrix by ID and select des/asc.

3.png4.png

The Matrix will show the result sorting by City.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

View solution in original post

5 REPLIES 5
PC2790
Community Champion
Community Champion

Hello @Krcmajster,

 

So if I understand correctly, you have City as your subcategory in sequence as ID --> Region -->Country -->City

So when you are trying to do a sort by -->City in the matrix settings, is it not working?

Something like this: 

PC2790_0-1614162367928.png

 

I don't have the option as you but I am assuming I need to create a hierarchy and add it to Rows to get the Category and subcategory?

Capture.PNG

No heirarchy is needed as such.

PC2790_0-1614166946399.png

 

If you can share your pbix file removing the sensitive data, I can take a look

@PC2790 Unfortunately I can't do that. But based on what you mentioned it is strange that it is not sorted. On the screenshots below you can see that I am doing the same thing, but the order is the same no matter if I select asc or desc

Capture.PNG

 

 

 

 

 

 

 

Capture3.PNGCapture2.PNG

 

 

 

 

Anonymous
Not applicable

Hi @Krcmajster 

Matrix visual currently could only be sort by the first row.

So sort by City column makes no sense when your City column is not the the first column in matrix row.

You can try my way, sort your ID column by City column and then sort your matrix by ID.

Your ID column is the first row, it will work.

My Sample:

1.png

Select ID in Fields and sort ID by City in Column Tools.

2.png

Build a Matrix.

5.png

Sort Matrix by ID and select des/asc.

3.png4.png

The Matrix will show the result sorting by City.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors