Forum Discussion
PaulBethancourt
3 years agoFrequent Visitor
Rankx is Incorrect when similar ranked column added to table
I'm using RANKX to rank the number of "Monthly Lines" based on a column called "Parent and TC City". The above rank work fine. If I add the field "Parent Org" to the table, then the ranking i...
- 3 years ago
Would something like this help?
Rank TC Parent City 2 = RANKX( ALL( 'Table'[Parent and TC City], 'Table'[Parent Org] ), [Monthly Lines] )It seems to work in both of your scenarios.
Let me know how this works.
pbix: Rankx Problem.pbix
dilshad_ahmed
3 years agoFrequent Visitor
It is because when you are including Parent Org, the context is getting changed. To avoid the context change you can use a table in your Rank Dax by cross joining the 'Parent and TC City' and 'Parent Org'. I have verified it and it gives the correct result.
My Dax looks like
Rank TC Parent City = RANKX(CROSSJOIN(ALL('Table'[Parent and TC City]),ALL('Table'[Parent Org])),[Monthly Lines])
You can also refer the below youtube video for understanding:
Hope it helps!