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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Switto
Helper IV
Helper IV

Distinct count for the awards

Hi Team,

We are working on a report which provides us with the awards given from the learning perspective.

 

It has categories like White, Purple, Brown, Gold. We are trying to get the count of unique awards given to individual ID.

 

In the learning category, White is the lowest and Gold is the highest. Individuals can earn awards by completing courses.

 

However, while counting if one person awarded White as well as Purple in the same category then it will be counted as 1 as White will be not counted. But the person awarded White but no other awards then it will be counted as 1.

 

I have three column 

1) Name: It has Individual ID-ProgrammeName- SubProgrammeName

2) Color: White or Purple or  Browne or Gold

3) Award Status: Awarded or In Progress

 

NameColorAward StatusCount
123-AA-BBBWhiteAwarded 
123-AA-BBBBrownAwarded1
234-AA-ZZZWhiteAwarded 
234-AA-ZZZBrownIn progress 
234-AA-ZZZGoldAwarded1
234-AA-AEWWhiteAwarded1
234-AA-AEWBrownIn progress 

 

Please let me know if we can achieve in PowerBI.

Thanks

S

 

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @Switto 

Try this:

Measure = 

VAR _nameTable =FILTER( ALL( 'Table' ), 'Table'[Name] = MAX( 'Table'[Name] ) )
VAR _addRank=
    ADDCOLUMNS(
        _nameTable,"rank",SWITCH(TRUE(),[Color] = "Gold", 1,[Color] = "Brown", 2,[Color] = "Purple", 3,[Color] = "White", 4)
    )
var _highest=MINX(_addRank,[rank])
var _countHighest=MINX(FILTER(_addRank,[Award Status]="Awarded"),[rank])

var _currentColor=MAX('Table'[Color])
var _currentRank=SWITCH(TRUE(),_currentColor = "Gold", 1,_currentColor = "Brown", 2,_currentColor= "Purple", 3,_currentColor = "White", 4)
RETURN IF(_currentRank=_countHighest,1,BLANK())

Result:

vangzhengmsft_0-1644901064799.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

2 REPLIES 2
v-angzheng-msft
Community Support
Community Support

Hi, @Switto 

Try this:

Measure = 

VAR _nameTable =FILTER( ALL( 'Table' ), 'Table'[Name] = MAX( 'Table'[Name] ) )
VAR _addRank=
    ADDCOLUMNS(
        _nameTable,"rank",SWITCH(TRUE(),[Color] = "Gold", 1,[Color] = "Brown", 2,[Color] = "Purple", 3,[Color] = "White", 4)
    )
var _highest=MINX(_addRank,[rank])
var _countHighest=MINX(FILTER(_addRank,[Award Status]="Awarded"),[rank])

var _currentColor=MAX('Table'[Color])
var _currentRank=SWITCH(TRUE(),_currentColor = "Gold", 1,_currentColor = "Brown", 2,_currentColor= "Purple", 3,_currentColor = "White", 4)
RETURN IF(_currentRank=_countHighest,1,BLANK())

Result:

vangzhengmsft_0-1644901064799.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bcdobbs
Community Champion
Community Champion

You could add a calculated column with combines Name and Color together eg 123-AA-BBB-White. It would be better to do that in PowerQuery so that the column gets compressed. At that point you can use DISTINCTCOUNT in a measure.

 

Looking at your data though is it possible for someone to have more than one row for the same award? If it isn't then you could just use COUNTROWS ( TableName ) in a measure.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.