cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LloydPowerBI
Frequent Visitor

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 @LloydPowerBI ,

 

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 @LloydPowerBI ,

 

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

Greg_Deckler
Super User
Super User

@LloydPowerBI 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!!!
Check out my External Tool for Power BI Desktop!
Microsoft Hates Greg's Quick Measures
Check out my latest book!

amitchandak
Super User
Super User

@LloydPowerBI ,

 

see if this changes can help

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

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!