Forum Discussion
Rankx not working
Hi everyone,
Hope maybe you can help? I am trying to build Rankx measure but it keeps coming back with 1 to 66 🙂
This is the dax i tried:
Ranking = RANKX(ALLSELECTED('Agent level stats'), CALCULATE(SUM('Agent level stats'[Number of Calls Handled])),,DESC,Dense)
i've also tried this one, where total Calls is a measure of "Total Calls = SUM('Agent level stats'[Number of Calls Handled])" and then this one:
Rank = RANKX(ALL('Agent level stats'),[Total Calls],,DESC,Dense)
Do you see anything wrong with my measure?
Thanks a million.
Erika_S ,
formulas
Calls = SUM('Table'[Number of Calls Handled])
Rank = rankx(ALLSELECTED('Table'[Agent ID]),[Calls],,DESC,Dense)what it is showing
9 Replies
- vanessafvgCommunity Championericka can you share some of your data and then say what you are trying to do? Are you ranking agent by total calls. what are you expecting. Why is 1-66 wrong, what rank are you wanting.
- Greg_DecklerCommunity Champion
Erika_S - I agree with vanessafvg , sample data and expected output please. This may help in the mean time https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452
- amitchandakSuper User
Erika_S , Measure seems to fine at a high level. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
What is wrong , what is expected
- Erika_SHelper I
Yes, thank you all. Here is the data sample attached.
Here is what i would expect to see. Ranked based on who took the most calls. I woud then hope to introduce another column into the calculation. But want to get the initial one to work 🙂 Rank in the table if for illustration, not the actual rank.
Agent ID Rank 1 5 2 6 3 3 4 2 5 4 6 1 Here is the example: (so sorry, i cant see where to attach pbix or worksheet).
Agent ID Number of Calls Handled Total Call Time (secs) 1 32 0 2 3 0 3 6 0 4 9 0 4 3 1864 4 1 191 4 9 244 5 1 98 5 14 2966 5 14 2974 5 14 3283 5 15 2916 5 36 8908 5 37 6354 5 46 10908 5 71 14398 5 74 9570 5 78 17655 6 15 4481 6 15 5238 6 16 2987 6 16 3266 6 16 3456 6 16 3559 6 16 3672 6 16 3712 6 16 3760 - AnonymousNot applicable
Hi Erika_S ,
Create a measure
No. of Calls handled Measure = SUM('Table'[Number of Calls Handled])Ranking Measure = RANKX(ALL('Table'[Agent ID]), [No. of Calls handled Measure],,DESC)Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)- Erika_SHelper I
This almost worked! I have added "Dense" as it was showing the bottom few as all on Rank 20. Dense didnt help though.
Ranking = RANKX(all('Agent level stats'[Agent ID]),[No Calls Handled],,DESC,Dense)thank youuuu!!
- amitchandakSuper User
Erika_S , refer to the attached file after signature and see if solve the purpose.
- Erika_SHelper I
I couldnt open pbix - says my version is too old:( so sorry...