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
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
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.