Forum Discussion

Erika_S's avatar
Erika_S
Helper I
6 years ago
Solved

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

  • vanessafvg's avatar
    vanessafvg
    Community Champion
    ericka 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.
  • 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

  • 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 IDRank
    15
    26
    33
    42
    54
    61

     

    Here is the example: (so sorry, i cant see where to attach pbix or worksheet).

     

    Agent IDNumber of Calls HandledTotal Call Time (secs)
    1320
    230
    360
    490
    431864
    41191
    49244
    5198
    5142966
    5142974
    5143283
    5152916
    5368908
    5376354
    54610908
    57114398
    5749570
    57817655
    6154481
    6155238
    6162987
    6163266
    6163456
    6163559
    6163672
    6163712
    6163760

     

    • Anonymous's avatar
      Anonymous
      Not 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_S's avatar
        Erika_S
        Helper 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!!
      • Erika_S's avatar
        Erika_S
        Helper I

        I couldnt open pbix - says my version is too old:( so sorry...