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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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