Forum Discussion
JustinDoh1
5 years agoPost Prodigy
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...
- 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
Jos_Woolley
5 years agoSolution Sage
Hi,
In the example you give, the only two possible entries in the 'Consent' column are 'Consented' and 'Refused'. As such, you can use:
Refused =
DISTINCTCOUNT ( 'Table'[ClientID] )
- CALCULATE (
DISTINCTCOUNT ( 'Table'[ClientID] ),
'Table'[Consent] = "Consented"
)If other entries are in fact possible within the 'Consent' column then please update your post with a more realistic dataset.
Regards
JustinDoh1
5 years agoPost Prodigy
Jos_Woolley Sorry. actually, there are different options for the value in the "Consent" column (like 'Historial', 'Not Eligible').