Forum Discussion
ALLSELECTED and RANKX not working as expected
I have spent last 10 hours or so trying to rank a single field filtered by some other fields and nothing works. It's driving me crazy, when I see a blog entry listing my solution, copy it and it still does not work.
Anyhow, I have this model and data:
ModelMarks dataStudent data
MarkRank is a calculated column using this formula:
On the screen below you can see it calculates rank properly over the entire data set.
Initital view
However, when I filter by year (or by school or both, it doesn't matter) I get this:
Wrong ranking
You can see that it does not re-calculate the rank as it should be to rank only displayed values.
I tried to change the formula to something like this:
8 Replies
- amitchandakSuper User
DMis , Refer to these. They converted most of the stuff related to Rank
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- DMisRegular Visitor
Thank you Amit.
I have seen these articles. I don't believe my problem lies with what's described there, but rather with ALLSELECTED.
- AnonymousNot applicable
If you want to have a dynamic value, try create measures instead of a column.
You need two measures separately, Try something like:
Mark measure = Sum(Marks[Mark]) Rank Mark = RANKX(ALLSELECTED('Marks'),Mark measure,,Dese,Dense)Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.