Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Erika_S
Helper I
Helper I

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.

1 ACCEPTED SOLUTION

@Erika_S ,

formulas

Calls = SUM('Table'[Number of Calls Handled])
Rank = rankx(ALLSELECTED('Table'[Agent ID]),[Calls],,DESC,Dense)

 

what it is showing

Screenshot 2020-09-07 20.15.06.png

View solution in original post

9 REPLIES 9
Erika_S
Helper I
Helper 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 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

 

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)
 
1.jpg
 
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

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 , refer to the attached file after signature and see if solve the purpose.

 

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

@Erika_S ,

formulas

Calls = SUM('Table'[Number of Calls Handled])
Rank = rankx(ALLSELECTED('Table'[Agent ID]),[Calls],,DESC,Dense)

 

what it is showing

Screenshot 2020-09-07 20.15.06.png

amitchandak
Super User
Super 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

Greg_Deckler
Super User
Super User

@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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
vanessafvg
Super User
Super User

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.




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.