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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community 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



Follow on LinkedIn
@ 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!:
DAX For Humans

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors