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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
StevenTeglman
Helper I
Helper I

Trouble with RANKX and Mutliple Columns

Hey friends,

 

I've been trying to use RANKX for a few days now to better filter my visuals, but have finally broken and come here asking for help.
I have this table:

StevenTeglman_0-1598950354091.png


And I'm trying to use a RankX Measure to rank VendorName based on the following Measure:

StevenTeglman_1-1598950685084.png


Which, as you can see, works great :

StevenTeglman_3-1598950912857.png

 

StevenTeglman_2-1598950891050.png


Yet when I add the Field name to the same visual table, the Vendor ranks go whacky, with multiple different vendors having the same "Rank"

StevenTeglman_4-1598951085001.png


Each vendor has the same set number of "Field Name"s. My end goal is to use the Vendor Rank and Field Name to display in 3 different bar graphs the top "Changed in VA" Field Names, of the top 3 Vendors (One graph per vendor). An easy solution would be to just create a calculated column, but unfortunately, I can't use that approach as I have slicers on the page which need to interact with the visuals I'm creating., and from my experience slicers don't work on column values.

Thanks for your help!

3 REPLIES 3
amitchandak
Super User
Super User

@StevenTeglman , Rank measure is pretty sensitive to row context. So the addition of field name to the table means all vendor inside the field name

example

City Rank = RANKX(all(Geography[City]),[Sales]) // this does not work with city id, all ranks are 1

City and ID Rank = RANKX(all(Geography[City],Geography[City Id]),[Sales]) // work with city id
Geography Rank = RANKX(all(Geography),[Sales])// work with city id lowest level in table

 

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
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

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

Hi @amitchandak 
Thank you for your response. I tried to implement what you said, yet I'm not sure it worked the way it's supposed to.

StevenTeglman_1-1598957194234.png

I wasn't expecting to need more than 18 gigs of ram to run DAX Measures 😅

StevenTeglman_0-1598957155130.png

The EX table has 1.5 million rows, but I still don't think that should happen?

 

Anyways, I think I'm just going to settle for using a static rank for my Vendors, instead of a measure. It's not exactly what I want, but it'll have to do.

Hi @StevenTeglman 

 

You might consider providing your dummy pbix that would be helpful for us to investigate it further. 

You can upload it to the onedrive for business and share the link here. please don't forget to disclose the expected results and remove the confidential info.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.