Forum Discussion
Ranking a measure
- 7 years ago
Hi Anonymous,
Based your sample, you could have a try with the measure below.
SumPointsRank = Var summry=SUMMARIZE(ALLSELECTED(Results),[Player],"Sum",SUM(Results[Points])) var tmp=ADDCOLUMNS(summry,"RNK",RANKX(summry,[Sum],,DESC,Dense)) return MAXX(FILTER(tmp,[Player]=SELECTEDVALUE(Results[Player])),[RNK])
If you don't want to create a temp table, you also could use the measure2.
Measure2=
RANKX(ALLSELECTED(Results),CALCULATE(SUM(Results[Points]),ALLEXCEPT(Results,Results[Player])),,DESC,Dense)Here is the output result.
More details, you could refer to the attachment.
Best Regards,
Cherry
Hi Anonymous,
Based your sample, you could have a try with the measure below.
SumPointsRank = Var summry=SUMMARIZE(ALLSELECTED(Results),[Player],"Sum",SUM(Results[Points])) var tmp=ADDCOLUMNS(summry,"RNK",RANKX(summry,[Sum],,DESC,Dense)) return MAXX(FILTER(tmp,[Player]=SELECTEDVALUE(Results[Player])),[RNK])
If you don't want to create a temp table, you also could use the measure2.
Measure2=
RANKX(ALLSELECTED(Results),CALCULATE(SUM(Results[Points]),ALLEXCEPT(Results,Results[Player])),,DESC,Dense)
Here is the output result.
More details, you could refer to the attachment.
Best Regards,
Cherry
Thanks for this solution. I had a similar requirement and it worked like a charm.
However, I have a category of Players as well, say A, B and C and I want to rank the Players within these categories. Wondering what change should I do in the below temp table measure to get the desired result.
Thanks in advance!!
SumPointsRank = Var summry=SUMMARIZE(ALLSELECTED(Results),[Player],"Sum",SUM(Results[Points])) var tmp=ADDCOLUMNS(summry,"RNK",RANKX(summry,[Sum],,DESC,Dense)) return MAXX(FILTER(tmp,[Player]=SELECTEDVALUE(Results[Player])),[RNK])