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

View all the Fabric Data Days sessions on demand. View schedule

Reply
tobiasreisaeter
Frequent Visitor

Count distinct person only on the basis of highest value in other coloumn

Hi!


I'm having an issue with counting the number of disinct persons based on the grades they have received. I have a fact that contains the persons ID, their grade8s) and the quarter in which they received it. With DAX I would like to only return the highest grade, and hence only count the person once in a given quarter (given that the person received more than one grade in a quarter). 

 

PersonID               Grade           Quarter

1                               4                    1

1                               7                     2  

1                               10                   2

2                                4                    2

3                               10                  1

3                                12                   1

 

 

The result should be that if I use a pivot with PersonID as rows and Grade as coloumn the measure should filter out the lowest grade(s) and only display the higest one:

 

PersonID               Grade           Quarter

1                               10                   2

2                                4                    2
3                                12                   1


Could anyone please help with this?

 

Kind regards

 

Tobias

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tobiasreisaeter

 

Create this measure

Max Grade = VAR inMax =CALCULATE(MAX(Table1[Grade]),ALLEXCEPT(Table1,Table1[PersonID]))
RETURN
IF(inMax= MAX(Table1[Grade]),1,0)

and then apply a visual filter on this measure to filter for values 1 , you will get teh desired result.

 

 

Thanks
Raj

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @tobiasreisaeter

 

Create this measure

Max Grade = VAR inMax =CALCULATE(MAX(Table1[Grade]),ALLEXCEPT(Table1,Table1[PersonID]))
RETURN
IF(inMax= MAX(Table1[Grade]),1,0)

and then apply a visual filter on this measure to filter for values 1 , you will get teh desired result.

 

 

Thanks
Raj

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors