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
kylerwimbush
Helper I
Helper I

Get Top 10 Employees based On Total Score

I have a table with employee names called DTM Info, and the column is called Full Name. I have a measure called Total Score which is just every score added together. I want to create a measure to show the Top 10 Employees with the highest scores but I am having difficulty using the TOPN function because it still returns every single employee name with their score, not just the top 10. Could anyone steer me in the right direction? 

1 ACCEPTED SOLUTION

HI,

Thank you for your message, and please check the below screenshot and the attached pbix file.

I amended to have a measure in the formula.

Jihwan_Kim_0-1684428382479.png

 

Show top5 only V2: = 
CALCULATE (
    [Score total:],
    KEEPFILTERS (
        WINDOW (
            1,
            ABS,
            5,
            ABS,
            ALL ( 'Name'[Full Name] ),
            ORDERBY ( [Score total:], DESC )
        )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

This pattern should work

=calculate([Total score],Top(5,all('DTM Info'[Full name]),[Total score]),values('DTM Info'[Full name]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, and how your expected outcome looks like, but I tried to create a sample pbix file like below.

Please check the below picure and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

Jihwan_Kim_2-1684426131208.png

 

Jihwan_Kim_1-1684426112387.png

 

 

Show top5 only: = 
CALCULATE (
    SUM( Score_fact[Score]),
    KEEPFILTERS (
        WINDOW (
            1,
            ABS,
            5,
            ABS,
            ALL ( 'Name'[Full Name] ),
            ORDERBY ( CALCULATE( SUM( Score_fact[Score]) ), DESC )
        )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


The Score is stored as a measure called [Total Score] so is there a way you can work that around to work for a measure instead of a column? 

HI,

Thank you for your message, and please check the below screenshot and the attached pbix file.

I amended to have a measure in the formula.

Jihwan_Kim_0-1684428382479.png

 

Show top5 only V2: = 
CALCULATE (
    [Score total:],
    KEEPFILTERS (
        WINDOW (
            1,
            ABS,
            5,
            ABS,
            ALL ( 'Name'[Full Name] ),
            ORDERBY ( [Score total:], DESC )
        )
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


That works, but it shows everyone elses names (not top 5) afterwards with a weird value. That doesn't matter if there is a way to limit the rows produced to 5. Is there a way that can happen? 

Hi,

Thank you for your message, and please check the below picture and the attached pbix file.

I am not sure if I understood your question correctly, but try to deselect unnecessary measures from the visualization.

 

Jihwan_Kim_0-1684465844622.png

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.