Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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.
| EmployeeID | Course | Competent |
| 1 | A | Yes |
| 1 | B | Yes |
| 2 | A | No |
| 3 | B | No |
| 4 | A | Yes |
| 4 | B | Yes |
Solved! Go to Solution.
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
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
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)
Hi @n3mo
Try this measure.
I hope I answered your question!
@n3mo , Create a measure using
DAX
DistinctCountCompetentEmployees =
CALCULATE(
DISTINCTCOUNT('Table'[EmployeeID]),
FILTER(
'Table',
'Table'[Course] = "A" || 'Table'[Course] = "B"
&& 'Table'[Competent] = "Yes"
)
)
Proud to be a Super User! |
|
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.