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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Antmkjr
Post Patron
Post Patron

Sort Column in a matrix by another column

https://drive.google.com/file/d/1kJpyOsEsR5Yl-xr0nUY7Ds-mJNT-bMXe/view?usp=sharing

 

AnuTomy_0-1626326285319.png

How to sort the column in matrix ,in this case Business Unit ,by Salary (The Business Unit with highest salary should come first)

 

9 REPLIES 9
Aditya_Meshram
Solution Supplier
Solution Supplier

Hi @Antmkjr You can do the following:

1. Go to More Options by clicking on the ellipsis icon (three dots) on the matrix visual.Aditya_Meshram_0-1626335059040.png

2. Select Sort by > Salary

Aditya_Meshram_1-1626335190101.png

3. This is the output. 

Aditya_Meshram_2-1626335262284.png

Hope this answers your question. 

 

AnuTomy_2-1626338368007.png

 

 

 

Thanks for reply, but my requirement is the Business Unit with highest salary should come first, in this case Houston city should be displayed first, then New York city, then Seattle and Los Angeles

 

Hi @Antmkjr ,

 

Create a column as below:

Rank = RANKX('Human Resources',SUMX(FILTER('Human Resources','Human Resources'[Business Unit]=EARLIER('Human Resources'[Business Unit])),'Human Resources'[Salary]),,DESC,Dense)

Then duplicate column "Business Unit" and choose sort by rank:

vkellymsft_0-1626678450187.png

And you will see:

vkellymsft_1-1626678534592.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

Brilliant !

One more question, if we are putting a filter on department, how to still make it work?

 

AnuTomy_0-1626852833557.png

 

Hi  @Antmkjr ,

 

Sorry,I couldnt find a good way to realize it,currently matrix only support column ranking,row ranking can only be fixed by my trick.

I can only do a ranking measure to show the ranking,but I cant make it rank dynamically per your request:

measure_Rank = IF(ISINSCOPE('Human Resources'[Departmets]),BLANK(), RANKX(ALLSELECTED('Human Resources'[Business Unit]),CALCULATE(SUM('Human Resources'[Salary]),ALLEXCEPT('Human Resources','Human Resources'[Business Unit],'Human Resources'[Departmets])),,DESC,Dense))

vkellymsft_0-1626861605325.png

Check my .pbix file attached.

 

Best Regards,
Kelly

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

Thanks alot for your time, let us wait and see if someone can help any further!

Hi  @Antmkjr ,

 

I have a deep thought about this case,and I'm 99% sure that columns cant be sorted dynamically based on selection in matrix.

You could propose your idea with comments via below link to make this function realize soon.

https://ideas.powerbi.com/ideas/

 

 

Best Regards,
Kelly

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

amitchandak
Super User
Super User

@Antmkjr , You can sort on total columns(Values) in matrix and on rows columns

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

How to sort on columns? In this case i want to sort it by Business Unit which is column.

The Business unit with highest salary should come first.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.