Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

URGENT Help - Get distinct user count based on group by multiple columns

I have a requirement to get the count of distinct users who completed the modules. As you can see from the data in the table below, A module can have multiple courses and each course will be assigned...
  • PaulOlding's avatar
    5 years ago

    Hi Anonymous 

    Try this measure.  It iterates the combination of modules and users and sees if the number of courses completed matches the total number of courses.

    Users who Completed Modules Count = 
    SUMX(
        SUMMARIZE('Table', 'Table'[Module Name], 'Table'[User Name]),
        VAR _Courses = CALCULATE(DISTINCTCOUNT('Table'[Course Name]), ALLEXCEPT('Table', 'Table'[Module Name]))
        VAR _Completed = CALCULATE(DISTINCTCOUNT('Table'[Course Name]), 'Table'[Status] = "Completed")
        RETURN
            IF(_Courses = _Completed, 1, 0)
    )