Forum Discussion

JustinDoh1's avatar
JustinDoh1
Post Prodigy
5 years ago
Solved

Exclude distinct count with OR

I am trying to write DAX formula with following logic:   Count distinct "ClientID" if one has "Refused" in Consent column, BUT, if one has "Consented" in Consent column, do not count (exclude) dis...
  • Jos_Woolley's avatar
    5 years ago

    Ok, thanks for clarifying.

    Refused Not Consented =
    VAR Refused =
        DISTINCT (
            SUMMARIZE (
                FILTER ( 'Table', 'Table'[Consent] = "Refused" ),
                'Table'[ClientID]
            )
        )
    VAR Consented =
        DISTINCT (
            SUMMARIZE (
                FILTER ( 'Table', 'Table'[Consent] = "Consented" ),
                'Table'[ClientID]
            )
        )
    RETURN
        COUNTROWS ( EXCEPT ( Refused, Consented ) )

    Regards