Forum Discussion
ALLSELECTED and RANKX not working as expected
DMis
In this case, you would need to rank by another columns (e.g. studentID). So you should have 3 measure in total:
MM = SUM(Marks[Mark])
ID= Sum(Marks([StudentID])
Final Rank =
RANKX (
ALL ( 'Table' ),
RANKX ( ALL ( 'Table' ), [MM],, ASC )
+ DIVIDE (
RANKX ( ALL ( 'Table' ), [ID],, DESC ),
( COUNTROWS ( ALL ( 'Table' ) ) + 1 )
))
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.
Paul,
Can you please elaborate on why this is happening in the first place? From the brief look at the new formula you provided, I am not sure what it's supposed to do, to be honest.
I just want to clarify that in the last screenshot first 20 records is how it supposed to be, but there is an excess produced, which is everything that does not have MM value. If I simply filter out all rows that do not have MM value, I get the desired result.
However, I still don't understand how come RANKX produces additional rows, which never existed in the data set to begin with. I don't expect it to behave as INNER JOIN on something else.
- Anonymous6 years agoNot applicable
DMis
I thought the additional rows are from the original table. I am a bit confusing now, can you share that sample pibx.The detail of the logic of the measure came from this post: https://community.powerbi.com/t5/Desktop/How-to-Rank-a-list-based-on-2-values-double-rankX/td-p/44008
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.- DMis6 years agoRegular Visitor
Hi Anonymous ,
The link to the project is at the bottom of the original post.
Appreciate you looking into this.