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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Navaneeth_
Regular Visitor

RANKX

I have a Email Interactions table which is at Interaction_ID and SDR_NAME(Sales rep name) level. I want to rank them based on a score (A measure), I'm using the below formula, using ALL() for the rank to consider all the SDRs and not just the selected one. This formula works fine, when I select a particular SDR it give the corresponding rank. But the rank becomes 1 when the timeline slicer is used. I tried ALLEXCEPT(Date Column) instead of ALL(), still not getting the right result. I'm new to dax, can I get some help here?

 

Email Rank =
RANKX(
    ALL('SALESLOFT_DETAILS'[SDR_NAME]),
    ([Email_Score]+[Email_Reply_Score])/2,
    ,
    DESC,
    Dense
)
2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

It is likely that your expression is returning unexpected values during eavulation. So try creating measure  Also ALL is not as good with RANKX as ALLSELECTED so try using it.

Generally speaking RANKX is pretty forgiving in my mind so the issue is usually in the expression part of the measure.

Example:
Here I have 3 different RANX measures:

Ranking simple = RANKX(ALLSELECTED(Ranking),Ranking[Average metric])

 

Ranking simple all = RANKX(ALL(Ranking),Ranking[Average metric])

 

Ranking simple all EID + desc + dense = RANKX(ALL(Ranking[EID]),Ranking[Average metric],,DESC,Dense)

In a table they look like this:
ValtteriN_0-1686221412855.png

 

Only the second measure is behaving weirdly this is due the ALL's interaction with Year + Month Slicer. When all values are  displayed the issue is gone:

ValtteriN_1-1686221479556.png

 

So in short, try using ALLSELECTED instead of ALL and double check your expression part of the measure.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




tamerj1
Super User
Super User

Hi @Navaneeth_ 
Please try

Email Rank =
RANKX (
    ALL ( 'SALESLOFT_DETAILS'[SDR_NAME] ),
    CALCULATE ( [Email_Score] + [Email_Reply_Score], ALL ( 'Table'[Date] ) ) / 2,
    ,
    DESC,
    DENSE
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.