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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ShoaibAhmed
Frequent Visitor

Matrix Multiple column sorting

Hi Power BI Community,

 

I am new to Power BI and would like to sort Matrix Coloumn as we do in excel Pivots. I have tried, but i cannot figure out how to fix it.

 

I want the multiple sorting as follows:

1) Chronological order Date - Ascending order

2) Beneficiary by Sum of Amount in each date - Descending order [The Beneficiary can come on any date and multiple times in a month]

3) Purpose by Amount in each beneficiary - Descending order

 

The result should be as follows:

Capture.PNG

4 REPLIES 4
smeadows
New Member

I know this is an old post but I believe the accepted "solution" is incorrect (in the sense that you can achieve the desired outcome but not via a specific setting).

 

I have verified that this can be accomplished partially in a similar way to Pivot Tables in Excel*.  In short, you must add the Row field(s) you want to sort by in order (typically from "inner" i.e. most detailed value to "outer" i.e. least detailed category).  You have to sort the "Rows" column in the visualization after each row field entry.  In the OP Example: 1) You would first add ONLY the Row Field = "Purpose" and then sort the "Rows" column in the desired order. 2) You would then add the "Beneficiary" row field and again sort the "Rows" column in the desired order (the "Purpose" field will remain sorted in the originally selected sort order. 3) You would then add the "Date" row field and again sort the "Rows" column in the desired order (the "Purpose" and "Beneficiary" fields will remain sorted in the originally selected sort order(s). and so on.

 

I have tested this on PBI Desktop "Version: 2.121.644.0 64-bit (September, 2023)".

 

*In Excel, you can programatically set the sort order of the Pivot table matrix row columns via VBA - through which you have full control of the visual.

V-lianl-msft
Community Support
Community Support

Hi @ShoaibAhmed ,

 

Please refer to these as alternatives:

https://community.powerbi.com/t5/Desktop/Sorting-by-multiple-columns/td-p/535690 

https://community.powerbi.com/t5/Desktop/Matrix-multiple-Sort-columns/td-p/523938 

There is no the same visual in pbi desktop for the time being

 

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

ShoaibAhmed
Frequent Visitor

Thanks @amitchandak.

but is there any other visual which can give the above result.

amitchandak
Super User
Super User

@ShoaibAhmed , Multiple sorting is not supported on matrix. You can sort on row item or values item and rest of the sorting will adjust automatically

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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