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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hans263
New Member

Highest score based on 2 variables

Hi experts, I have an issue regarding a table with staffmembers, training they followed and the scores given for each training.

Table looks like this:

hans263_0-1662711304721.png

The result should be that for each department the number of maximimum(highest) scores are returned (highest score for each staffmember), and also a sum of maximum scores per department. I have used RANKX but there is an issue regarding strings and integerrs. Very anxious to see what solutions are available. 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @hans263 
Please refer to attached sample file with the solution

1.png

Count of Highest Scores = 
VAR CurrentScore = SELECTEDVALUE ( 'Table'[TrainingTypescore] )
RETURN
    COUNTROWS (
        FILTER (
            VALUES ( 'Table'[Staffmember] ),
            CALCULATE ( MAX ( 'Table'[TrainingTypescore] ), ALL ('Table'[NameTrainingFollowed], 'Table'[TrainingTypescore] ) )
                = CurrentScore
        )
    ) + 0

View solution in original post

6 REPLIES 6
hans263
New Member

Yep. This works great! Many thx. 

tamerj1
Super User
Super User

Hi @hans263 
Please refer to attached sample file with the solution

1.png

Count of Highest Scores = 
VAR CurrentScore = SELECTEDVALUE ( 'Table'[TrainingTypescore] )
RETURN
    COUNTROWS (
        FILTER (
            VALUES ( 'Table'[Staffmember] ),
            CALCULATE ( MAX ( 'Table'[TrainingTypescore] ), ALL ('Table'[NameTrainingFollowed], 'Table'[TrainingTypescore] ) )
                = CurrentScore
        )
    ) + 0

Additionale question: Current Score holds the maximum of found results. If I want to use that value, how can I get this back into a Column? Or otherwise, the number of unique staff members for echt department. OPS=1, Sales=3

@hans263 
Modified file attached

1.png

Count of Highest Scores = 
SUMX ( 
    VALUES ( 'Table'[NameTrainingFollowed] ),
    CALCULATE (
        VAR CurrentScore = SELECTEDVALUE ( 'Table'[TrainingTypescore] )
        RETURN
            COUNTROWS (
                FILTER (
                    VALUES ( 'Table'[Staffmember] ),
                    CALCULATE ( MAX ( 'Table'[TrainingTypescore] ), ALL ('Table'[NameTrainingFollowed], 'Table'[TrainingTypescore] ) )
                        = CurrentScore
                )
            ) + 0
    )
)

Awesome. Last question. I finaly want to show the response. So in fact Count of Highest Score devided by the total number of staff members for a give department in %.  

@hans263 
See attached modified file

1.png

% of Highest Score = 
VAR Numerator = [Count of Highest Scores]
VAR Denominator = 
    COUNTROWS ( 
        CALCULATETABLE ( 
            VALUES ( 'Table'[Staffmember] ), 
            ALLEXCEPT ( 'Table', 'Table'[Department] ) 
        ) 
    )
VAR Result = DIVIDE ( Numerator, Denominator )
RETURN
    Result

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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