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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
n3mo
New Member

Distinct Count against multiple criteria in the same column

Hi all,

 

Been trying to work out a distinct count but can't seem to get it work with the results I've found.

I am trying to calculate the number of personnel within the organisation that have completed course A & B from data stored within a single list. If A&B both appear in the course column then the person is competent. Sample data is below. 

 

Hopefully this makes sense. 

EmployeeIDCourseCompetent
1AYes
1BYes
2ANo
3BNo
4AYes
4BYes
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a calculated column like

Competent =
VAR RequiredCourses = { "A", "B" }
VAR CompletedCourses =
    CALCULATETABLE (
        VALUES ( 'Table'[Course] ),
        ALLEXCEPT ( 'Table', 'Table'[Employee ID] )
    )
VAR Matches =
    INTERSECT ( CompletedCourses, RequiredCourses )
VAR Result =
    IF ( COUNTROWS ( Matches ) = COUNTROWS ( RequiredCourses ), "Yes", "No" )
RETURN
    Result

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

You could create a calculated column like

Competent =
VAR RequiredCourses = { "A", "B" }
VAR CompletedCourses =
    CALCULATETABLE (
        VALUES ( 'Table'[Course] ),
        ALLEXCEPT ( 'Table', 'Table'[Employee ID] )
    )
VAR Matches =
    INTERSECT ( CompletedCourses, RequiredCourses )
VAR Result =
    IF ( COUNTROWS ( Matches ) = COUNTROWS ( RequiredCourses ), "Yes", "No" )
RETURN
    Result
n3mo
New Member

Thanks, however it is the 'Competent' I am trying to calculate. Maybe I went wrong by showing this in a column. The output would effectively be Competent=2 (empID 1&4), NotCompetent=2 (empID 2&3)

Uzi2019
Super User
Super User

Hi @n3mo 

 

Try this measure.

Count =
CALCULATE(DISTINCTCOUNT(Course[EmployeeID]),FILTER(ALL(Course),Course[Course]="A" || Course[Course]="B"),Course[Competent]="Yes")
 
Uzi2019_0-1737027817537.png

 

 

I hope I answered your question!

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
bhanu_gautam
Super User
Super User

@n3mo , Create a measure using

 

DAX
DistinctCountCompetentEmployees =
CALCULATE(
DISTINCTCOUNT('Table'[EmployeeID]),
FILTER(
'Table',
'Table'[Course] = "A" || 'Table'[Course] = "B"
&& 'Table'[Competent] = "Yes"
)
)




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

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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