Forum Discussion
hobosapien
Helper I
1 year agoRANKX returning incorrect values for every row
I have put together the following code which returns the first table below EVALUATE VAR Table1 = SUMMARIZE('f_Call Metrics','f_Call Metrics'[Agent],"AVG Adherence",AVERAGE('f_Call Met...
- Anonymous1 year ago
Hi hobosapien ,
I suggest you to try code as below.
EVALUATE VAR Table1 = SUMMARIZE('f_Call Metrics','f_Call Metrics'[Name],"AVG Adherence",AVERAGE('f_Call Metrics'[Adherence %])) VAR TableRanking = ADDCOLUMNS(Table1,"Rank", RANKX(Table1,CALCULATE(SUM('f_Call Metrics'[Adherence %]),FILTER(Table1,'f_Call Metrics'[Name] = EARLIER([Name]))),,DESC,Dense)) RETURN TableRanking ORDER BY [Rank]Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
Hi hobosapien ,
I suggest you to try code as below.
EVALUATE
VAR Table1 = SUMMARIZE('f_Call Metrics','f_Call Metrics'[Name],"AVG Adherence",AVERAGE('f_Call Metrics'[Adherence %]))
VAR TableRanking = ADDCOLUMNS(Table1,"Rank",
RANKX(Table1,CALCULATE(SUM('f_Call Metrics'[Adherence %]),FILTER(Table1,'f_Call Metrics'[Name] = EARLIER([Name]))),,DESC,Dense))
RETURN
TableRanking
ORDER BY [Rank]
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hobosapien
Helper I
1 year agoYour solution works but I found I was not referencing the earlier Summarized table in my RANKX call and that fixed it. Thank you for the help!