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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
datadelta
Helper III
Helper III

Trying to use RANKX but it's not working due to multiple columns

I've been getting help on how to solve this issue but I'm stuck now.

 

I have an Excel spreadshee with multiple columns and multiple rows.  I need to rank the first column according to how much was sold in the corresponding columns.  Not by the sum total but by who sold the most with the associated columns.

 

Below I show, Locations in the first column and the other columns are how much they sold of the associated (hidden) product

 

Can I use RANX or something else or can Power BI not handle this and I have to do in Excel with a pivot table rank?

 

Thanks.

 

datadelta_0-1631117942733.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@datadelta , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

You have options like

column rank 

 

rank = rankx(filter(table, [customer] = earlier([customer]), [Column],,desc,dense)

 

measure rank

 

rank = rankx(filter(allselected(table[Customer], Table[Product]) , [customer] = max([customer]), calculate(sum(Table[Column])) ,,desc,dense)

 

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-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

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @datadelta 

how about using this function? you can choose a column to define the sort order of another column by setting the Sort by column

vxiaotang_0-1631501618592.png

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column#set-the-sort-by-colu...

 

 

Best Regards,

Community Support Team _Tang

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

amitchandak
Super User
Super User

@datadelta , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

You have options like

column rank 

 

rank = rankx(filter(table, [customer] = earlier([customer]), [Column],,desc,dense)

 

measure rank

 

rank = rankx(filter(allselected(table[Customer], Table[Product]) , [customer] = max([customer]), calculate(sum(Table[Column])) ,,desc,dense)

 

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.