Forum Discussion
RANKX Returning False Ties
- 8 years ago
The problem appears to be that the Client Rank measure is using the rows of the 'Client Data' table as a basis for the ranking, rather than the distinct Customer Codes.
The result is that any client whose [Total Client Rev] is at least as large as the largest [Total Client Rev] revenue evaluated in the row context of any individual row of 'Client Data' will be ranked 1, and so on.
If you adjust your measure as follows, it should give you sensible ranks:
Client Rank = RANKX ( ALL ( 'Client Data'[Customer Code] ), [Total Client Rev],, DESC )
Regards,
Owen
In this scenario the problem is well explained how it comes from the structure of the data and what is used as parameters in the RANKX function.
In a different scenario I encountered a different possible cause: Rounding error.
When the calcualton is done in the second parameter of RANKX and then it is done again in the third (or blank) parameter for comparison, there can be a rounding difference, so that the rank is not matched exactly and the neighboring rank is returned resulting in wrong ties, and also ties that seem not to comply with the ties setting in the fifth parameter in case it is set to "dense".
The code that produces the wrong ranks has this structure:
RANKX(MyDimension[MyAttribute], [MyMeasure])The code that fixes the problem has this structure:
RANKX(MyDimension[MyAttribute], ROUND([MyMeasure], 4))