Forum Discussion

qwertzuiop's avatar
qwertzuiop
Icon for Advocate III rankAdvocate III
3 years ago
Solved

Conditional count

Hello dear Power-BI-Community   Following problem to solve: Let's assuem this table:   Person Check A 1 A 0 A 0 B 0 B 0 C 1 C 1 D 0 D 0 D 0   Peo...
  • rsbin's avatar
    3 years ago

    qwertzuiop ,

    As Syk , suggested, this is easiest done in two steps.  I would do it this way.

    Create a new Calculated Column:

    TotalChecks = CALCULATE( SUM(Checks[Check] ),
                         ALLEXCEPT( Checks, Checks[Person] ))

    PersonCheckTotalChecks

    A 1 1
    A 0 1
    A 0 1
    B 0 0
    B 0 0
    C 1 2
    C 1 2
    D 0 0
    D 0 0
    D 0 0

    Then create a new Measure:

    0_Checks = CALCULATE( DISTINCTCOUNT( Checks[Person] ),
                         FILTER( Checks, Checks[TotalChecks] = 0 ))

    Trust this works for you.

    Regards,