Forum Discussion
How to Count Users with Multiple Mourse Completions?
Hi team,
I need to count people who are compliant with all courses that our company offers to them. Anyone who completes all courses is compliant, others are not.
For example, let's say we have 5 courses for 4 users, and the first three courses are requirements to become compliant. How should I code it?
Sorry, if it's an easy question. I can think of it in an algorithmic way, but not sure how to write it in DAX. Appreciate your suggestions.
First, create a calculated column
Count = IF ( 'Table'[Course] IN { "C1", "C2", "C2" } && 'Table'[Completed] = "No", 1 )Then create this measure:
Compliant = SUMX ( SUMMARIZE ( 'Table', 'Table'[Name], "CountNo", CALCULATE ( sum('Table'[Count]), ALLEXCEPT ( 'Table', 'Table'[Name] ) ) ), IF ( [CountNo] = BLANK (), 1 ) )
5 Replies
- danextian
Super User
Hi Mahdi1366 ,
My understanding is any [Name] that has [Completed] = No is non-compliant so if count of no of a name is blank, should be compliant. The original logic showed the total on a per name basis but not as a whole. Please try this instead.
Compliant = SUMX ( SUMMARIZE ( 'Table', 'Table'[Name], "CountNo", CALCULATE ( COUNTROWS ( 'Table' ), ALLEXCEPT ( 'Table', 'Table'[Name] ), 'Table'[Completed] = "No" ) ), IF ( [CountNo] = BLANK (), 1 ) )