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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.


@ 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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors