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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
KW123
Helper V
Helper V

Rank based on how many goals hit, then % to Goal

Hi there, 

I am trying to rank employees based on if they have hit their 3 different monthly goals and then rank them by the % to goal.  

EmployeeSales Item 1Goal 1% To goal 1Sales Item 2Goal 2% To Goal 2Sales Item 3Goal 3% To Goal 3How many goals hit (/3)% to Total Goal (30)Rank 
A55100%1010100%1515100%3300%1
B55100%91090%41527%2217%3
C1520%21020%2015133%1173%5
D75140%11010%101567%1217%4
E2540%1510150%2515167%2357%2


In the example above, employee A has a lower total % to goal than employee E, but employee A hit all three goals which puts them higher ranked.  

My three Sales Items columns are all Measures that I calculated.  I tried using the following DAX where 'Table'[GPA] = 'Table'[How Many goals hit /3] and [income] = [% to total Goal]

RankedByGPA(Income) = 
RANKX(ALL('Table'), 
    RANKX (ALL('Table'), 'Table'[GPA])
        + DIVIDE( 
            RANKX(ALL('Table'), 'Table'[Income]), 
            (COUNTROWS(ALL('Table')) + 1)
        )
, , ASC)

But I believe my measures are creating the wrong calculations.  

Any guidance would be much appreciated!! 

1 ACCEPTED SOLUTION

Hi @KW123 please try this

Rank =
RANKX(
    ALLSELECTED('Employees'),
    [Goals_Hit] * 1000 + [Total_Percentage],
    ,
    DESC,
    Dense
)

View solution in original post

6 REPLIES 6
techies
Solution Sage
Solution Sage

Hi @KW123 please try using these 3 measures

 

Goals_Hit measure =
VAR Goal1Hit = IF(SUM('Employees'[Sales Item 1]) >= SUM('Employees'[Goal 1]), 1, 0)
VAR Goal2Hit = IF(SUM('Employees'[Sales Item 2]) >= SUM('Employees'[Goal 2]), 1, 0)
VAR Goal3Hit = IF(SUM('Employees'[Sales Item 3]) >= SUM('Employees'[Goal 3]), 1, 0)
RETURN Goal1Hit + Goal2Hit + Goal3Hit
 
Total_Percentage measure=
SUM('Employees'[% goal1]) + SUM('Employees'[% goal2]) + SUM('Employees'[% goal3])
 
Rank measure =
RANKX(
    ALL('Employees'),
    [Goals_Hit] * 1000 + [Total_Percentage],
    ,
    DESC,
    Dense
)

Thank you for the reply!! 

That is so close to working.  I created the exact measures you listed however it is ranking the empoyees as a whole rather for just the selected time period.  See screen shot below.  

Additionally, I tried to use the PBI filter to only show the top 5 (which is what the stakeholder has requested) and it is not showing the top 5. 

KW123_1-1746815303789.png

 



KW123_0-1746815274612.png

 

Hi @KW123 please try this

Rank =
RANKX(
    ALLSELECTED('Employees'),
    [Goals_Hit] * 1000 + [Total_Percentage],
    ,
    DESC,
    Dense
)

Thank you so much!!!! That worked!!! I really appreciate your help with this. 

bhanu_gautam
Super User
Super User

@KW123 , Try using

DAX
RankedByGoalsAndIncome =
RANKX(
ALL('Table'),
'Table'[How many goals hit (/3)] +
DIVIDE('Table'[% to Total Goal (30)], 1000),
,
DESC
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you so much for that!! 

I tried it and It returned values of all 1.  I am not sure if it is because of my measures?

KW123_0-1746724580833.png

The measure for each of the three sales items are  
[SalesItem1] =

CALCULATE (
    DISTINCTCOUNT ( 'Sales'[SalesID1]),
    FILTER (
       ALLSELECTED ( 'Dates'),
        [Date]
    IN FILTERS ( 'Dates'[Date] )
    )
)

[MeetsGoalSalesItem1]
IF (SUM('Sales'[SalesItem1]) >= 'Goals'[GoalSalesItem1], 1, 0)

[GoalSalesItem1] = 
CALCULATE (
    SUM ( 'Goals'[Goal1]),
    FILTER (
        ALLSELECTED ( 'Dates'),
        [Date]
    IN FILTERS ( 'Dates'[Date] )
    )
)

The Goals Met Column in the above SS is just [MeetsGoalSalesItem1] + [MeetsGoalSalesItem2] + [MeetsGoalSalesItem3]

For the % Goal Total, it is the same calculations as above, just %
 
Hopefully that provides some context behind the measures. 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.