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
Anonymous
Not applicable

Custom sorting in a matrix table.

Hello,

Is there a way of sorting subcategory /2,3 and more cascades/ in a matrix table? Now I can sort first cascade or category names by SORT by Column method.

Subcategory is automatically sorted by alphabetically. Need help, thank you.

1 ACCEPTED SOLUTION

@Anonymous , Create a sort column

 

subcategories 1 = subcategories

sort subcategories=

switch([subcategories],

"C",1,

"B",2,

"D",3,

"A",4,5)

or like

switch( true() ,

[subcategories] ="C",1,

[subcategories] ="B",2,

[subcategories] ="D",3,

[subcategories] ="A",4,5)

 

and mark "sort subcategories" as sort column subcategories 1 and use subcategories 1 in viusal

refer steps

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi, maybe not exactly but this solution worked for me, It allows sorting using RANKX function on main categories, I'm sure it can work with subcategories as well

 

https://alintelligence.tech/sort-matrix-by-selected-columns-with-rankx/

amitchandak
Super User
Super User

@Anonymous , Matrix does have multi -sort option as of now. So if sort on the category it should sort on the sub-category also . If sort on values all category and subcategory should sort based on the value

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for reply. But I couldn't find any sorting options on matrix. Where I can find it? SS or path needed. Thank you.

@Anonymous , on click on the column name it should sort. There is option three ... dots .

 

If you created a pivot using column/s, then it sort column total not on the measure or on row columns

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

This is not what I am looking for. I mean

There are 3 categories. Each category has subcategories.  For example first A category has A,B,C,D subcategories.

I want it sort C,B,D,A. not by value or alphabetic. Full custom. C's value may be greater or less than B's value. It doesn't matter. I want see C's value on top. Thank you. 

@Anonymous , Create a sort column

 

subcategories 1 = subcategories

sort subcategories=

switch([subcategories],

"C",1,

"B",2,

"D",3,

"A",4,5)

or like

switch( true() ,

[subcategories] ="C",1,

[subcategories] ="B",2,

[subcategories] ="D",3,

[subcategories] ="A",4,5)

 

and mark "sort subcategories" as sort column subcategories 1 and use subcategories 1 in viusal

refer steps

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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