Forum Discussion
Struggling with RANKX
- 5 years ago
rogerdea
I checked the file, you need to insert the location and the location group from the areas table to the visual:You can download the file: HERE
Location Rank = RANKX( ALLSELECTED(Areas[Location]), CALCULATE(SUM(Scores[Score])) ) -------------------------------------------------------- Overall Rank = RANKX( ALLSELECTED(Areas[Location],Areas[Location_Group]), CALCULATE(SUM(Scores[Score])) )________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
rogerdea
Here are the two ranking measures:
Overall Rank =
RANKX(
ALL(T9[Location],T9[Location_Group]),
CALCULATE(SUM(T9[Score]))
)location Rank =
RANKX(
ALL(T9[Location]),
CALCULATE(SUM(T9[Score]))
)
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
- rogerdea5 years agoHelper IV
Thanks very much and i got the simpler DAX working however i've now realised in my real work rather than this example the [Location_Group] is stored in another table. And using this dax below gives me the error when trying to use the location_group in this other table:
"All column arguments of the ALL/ALLNOBLANKROW/ALLSELECTED/REMOVEFILTERS function must be from the same table."
So for the DAX:
RANKX =
ALL(T9[Location]),T9[Location_Group]),
CALCULATE(SUM(T9([Score]))
)
If T9[Location_Group]) was from another table in the powerBI how could this work or be written?
Thanks
- Fowmy5 years agoSuper User
rogerdea
What is the relationship between the tables? Can you share a dummy PBIX file that represents your actual model?________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
- rogerdea5 years agoHelper IV
Thanks very much here's a link to the pbx example im using:
https://drive.google.com/file/d/1wSKbEPxO0IUNLF6Cr_IJH8uimJUUNwN1/view?usp=sharing
You can see i only have one of your DAX examples working but theres repeating locations as well which i dont want.
Also what would be amazing is for these rankings to be able to recalculate whenever the filter (or any other i add in) are applied.