Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Distinct count based off two columns

Hello

I am trying to create a measure that will distinct count based on more than one column.   I want to count if 1). InProgram is = 1 AND 2) the program ID is distinct.  I have included and example below.

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hello please try :

     

    Count of students = CALCULATE(DISTINCTCOUNT(lmyers31[Student ID]),FILTER(lmyers31,lmyers31[InProgram] = 1))

     

     

     

    And result:

     

    if this helps, kindly accept as solution and a kudos is appreciated

      

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello please try :

     

    Count of students = CALCULATE(DISTINCTCOUNT(lmyers31[Student ID]),FILTER(lmyers31,lmyers31[InProgram] = 1))

     

     

     

    And result:

     

    if this helps, kindly accept as solution and a kudos is appreciated

      

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 

    please try the following measure 

    Active Students =
    COUNTROWS (
        CALCULATETABLE ( VALUES ( 'Table'[Student ID] ), 'Table'[InProgram] = 1 )
    )

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    This worked perfectly. Thank you so much!