Forum Discussion
Unique Rank for column
- 5 years ago
Hi Anonymous
with a calculated column you can do it like this :
Distinct Rank without Ties = VAR _Rank = RANKX(ALL('Table'),'Table'[Value],,DESC) VAR _CountIfExists = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Value] = EARLIER('Table'[Value]) && 'Table'[Sub-Category] <= EARLIER('Table'[Sub-Category]))) - 1 RETURN _Rank + _CountIfExistsWith kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut) - 5 years ago
Hi, Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create two measures as below.
R = var r1 = RANKX( ALL('Table'), CALCULATE(SUM('Table'[Value])) ) var r2 = RANKX( FILTER( ALL('Table'), 'Table'[Value]=SELECTEDVALUE('Table'[Value]) ), CALCULATE(MAX('Table'[Sub-Category])),,ASC ) return r1*100+r2 Rank = RANKX( ALL('Table'), [R] )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
with a calculated column you can do it like this :
Distinct Rank without Ties =
VAR _Rank = RANKX(ALL('Table'),'Table'[Value],,DESC)
VAR _CountIfExists = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Value] = EARLIER('Table'[Value]) && 'Table'[Sub-Category] <= EARLIER('Table'[Sub-Category]))) - 1
RETURN
_Rank + _CountIfExists
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
Hey FrankAT ,
I found on the internet the answer -
All I needed to do is to add a Random Var and add it to the Rank.
Thanks!