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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
charlesawalsh
Frequent Visitor

Sort Row Headers AND Column Headers in Matrix Visualization

I have a data set grouped into two different sets of ordinal categories that I want to view in a matrix. This is easily achieved in an excel pivot table via manually dragging and dropping the categories into the correct position, but drag and drop is not offered in the PowerBI matrix visual.

I already found and followed one of the several forum posts explaining how to add an extra conditional column with numbers assigned to each categorical value to use for sorting. I added two conditional columns, one for each of the two sets of categories.

charlesawalsh_1-1727841277359.png

 

However, it appears that numeric sorting solution can be only be applied to either the columns or to the rows, but not to both at the same time.

 

Did I miss a step? Is there a work around?

charlesawalsh_0-1727840314592.png

Starting from the left the column headers should be ordered: Extra Narrow, Narrow, Mid-Width, Wide, Extra-Wide. 

Starting from the top the row headers should be ordered: Extra-Short, Short, Mid-Length, Long, Extra-Long. 

Its surprising that PowerBI doesn't have feature parity with the Excel pivot table yet. Its almost 2025. 

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @charlesawalsh - In Power BI, handling multiple sets of ordinal categories in a matrix visual can indeed feel restrictive compared to Excel's more intuitive drag-and-drop functionality

If sorting issues persist, here are some alternative approaches:Switch to a Table Visual: If the Power BI Matrix Visual is too restrictive, consider using the Table Visual. You can manually create measures or columns that simulate a matrix format.Custom Visuals: Some custom visuals from Power BI’s AppSource (like Advanced Matrix visuals) may offer more flexibility in ordering and sorting categories.Power BI doesn't have Excel's full pivot-table functionality yet, but with the use of sorting columns and proper configuration, you can replicate most of the desired behavior.

Set Sort by Column for Each Category: Power BI allows you to use the "Sort by Column" feature to force the categories into the correct order:For Rows: Select your row category field (e.g., "Length Category") and click on Column ToolsSort by Column. Select the corresponding conditional column you created for ordering rows (e.g., "Length Sort").For Columns: Similarly, select your column category field (e.g., "Width Category") and sort it by the corresponding sorting column (e.g., "Width Sort").Ensure Matrix Visual Uses These Sort Orders:Add the Length Category to the Rows field in the matrix visual.Add the Width Category to the Columns field in the matrix visual.The sorting should now respect the custom ordering set in your sorting columns.

 

Hope the above process and approach helps.

 





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

Proud to be a Super User!





View solution in original post

charlesawalsh
Frequent Visitor

That worked! You are the man. 

View solution in original post

2 REPLIES 2
charlesawalsh
Frequent Visitor

That worked! You are the man. 

rajendraongole1
Super User
Super User

Hi @charlesawalsh - In Power BI, handling multiple sets of ordinal categories in a matrix visual can indeed feel restrictive compared to Excel's more intuitive drag-and-drop functionality

If sorting issues persist, here are some alternative approaches:Switch to a Table Visual: If the Power BI Matrix Visual is too restrictive, consider using the Table Visual. You can manually create measures or columns that simulate a matrix format.Custom Visuals: Some custom visuals from Power BI’s AppSource (like Advanced Matrix visuals) may offer more flexibility in ordering and sorting categories.Power BI doesn't have Excel's full pivot-table functionality yet, but with the use of sorting columns and proper configuration, you can replicate most of the desired behavior.

Set Sort by Column for Each Category: Power BI allows you to use the "Sort by Column" feature to force the categories into the correct order:For Rows: Select your row category field (e.g., "Length Category") and click on Column ToolsSort by Column. Select the corresponding conditional column you created for ordering rows (e.g., "Length Sort").For Columns: Similarly, select your column category field (e.g., "Width Category") and sort it by the corresponding sorting column (e.g., "Width Sort").Ensure Matrix Visual Uses These Sort Orders:Add the Length Category to the Rows field in the matrix visual.Add the Width Category to the Columns field in the matrix visual.The sorting should now respect the custom ordering set in your sorting columns.

 

Hope the above process and approach helps.

 





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

Proud to be a Super User!





Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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