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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Help: RANKX with filtering from another table

Hi there,

 

My first post so apologies if this has been answered elsewhere.

 

I'm looking to add a ranking to a column and dynamically change the results and subsequently the rank when filtered by another field. The current syntax I'm using is:

 

Rank =
RANKX ( ALL ( Table[Column_Name] ), CALCULATE ( SUM ( Table[Column_Name] ) ) )
 
This works perfectly fine in isolation and gives me the correct ranking. The issue is, when I create a filter using a field from another table, the field that I'm ranking remains the same, when I would expect it first to be filtered, and then the ranking to be applied.
 
As an example, let's say we have 100 companies and all are ranked 1-100, the current ranking syntax works fine. I then add a filter for company industry (which sits in another table), I would then expect when I select an industry for the initial results to change, say to 50 companies and then the ranking to display the 1-50 for the industry selected.
 
Hope that makes sense. Driving me mad so any help would be great, thank you.
 
Lloyd
1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1600050174190.png

v-lionel-msft_0-1600233745581.png

 

Best regards,
Lionel Chen

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

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1600050174190.png

v-lionel-msft_0-1600233745581.png

 

Best regards,
Lionel Chen

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

Greg_Deckler
Super User
Super User

@Anonymous See if this helps:

https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452

 

Otherwise maybe post sample data and expected output.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous ,

 

see if this changes can help

RANKX ( ALLSELECTED  ( Table[Column_Name] ), CALCULATE ( SUM ( Table[Column_Name] ) ) )

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.