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
ClemTiger0408
Frequent Visitor

Ranking employees with managers in table

I am trying to rank all employees by NPS (which is calculated as the average of NPS by row) in a table with the manager alongside the employee name but not included in the ranking group.

 

From my research I tried the formula below:

RANKX(ALLSELECTED (Table1), calculate(average(Table1[SPS])),,desc,dense) 
But when I try it, everyone ties at 2. I think this is because the data has every single NPS survey result (meaning many for each employee) so the ALLSELECTED is every single line (cold be wrong).
 
If I try:
RANKX(ALLSELECTED (Table1[employee]),calculate(average(Table1[SPS])),,desc,dense)
then the result is ranking each employee within the manager grouping as opposed to ranking all the employees amongst each other.
 
I'm not quite sure what I'm doing wrong. Thanks ahead of time!
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @ClemTiger0408 

If i understand you correctly, you could create measures as below :

avg = CALCULATE(AVERAGE('Table'[NPS]),ALLEXCEPT('Table','Table'[employee]))

rank regradless of manager = RANKX(ALL('Table'),[avg],,DESC,Dense)

avg2 = AVERAGE([NPS])

rank by manager group = RANKX(ALL('Table'[employee]),[avg2],,DESC,Dense)

Capture18.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @ClemTiger0408 

Is this problem sloved? 

If it is sloved, could you kindly accept it as a solution to close this case?

If not, please let me know.

 

Best Regards

Maggie

v-juanli-msft
Community Support
Community Support

Hi @ClemTiger0408 

Is this problem sloved? 

If it is sloved, could you kindly accept it as a solution to close this case?

If not, please let me know.

 

Best Regards

Maggie

v-juanli-msft
Community Support
Community Support

Hi @ClemTiger0408 

If i understand you correctly, you could create measures as below :

avg = CALCULATE(AVERAGE('Table'[NPS]),ALLEXCEPT('Table','Table'[employee]))

rank regradless of manager = RANKX(ALL('Table'),[avg],,DESC,Dense)

avg2 = AVERAGE([NPS])

rank by manager group = RANKX(ALL('Table'[employee]),[avg2],,DESC,Dense)

Capture18.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.