Forum Discussion
JRowe
4 years agoNew Member
Distinct Count with AND
I need to write a dax measure that tells me how many ID's there are with email AND mobile. There is a row of data for each Contact detail, so each ID has multiple rows. Therefore I would need a distinct count of ID's. Emails and Mobiles are denoted by a 1. An example table below. so ID= 1 has an email and mobile, ID = 2 does too but ID = 3 only has email. I'm working in direct query so can't create any calculated columns to do with ID counts I think, so it has to be a measure?
| ContactID | ID | Mobile | |
| 1 | 1 | 1 | 0 |
| 2 | 1 | 1 | 0 |
| 3 | 1 | 0 | 1 |
| 4 | 2 | 1 | 0 |
| 5 | 2 | 0 | 1 |
| 6 | 2 | 0 | 1 |
| 7 | 3 | 1 | 0 |
| 8 | 3 | 1 | 0 |
| 9 | 3 | 1 | 0 |
Hi JRowe
for a card visual please try > New measure
ID Count (E & T) = COUNTROWS ( FILTER ( SUMMARIZE ( TableName, TableName[ID], "E&T", SUM ( TableName[Email] ) * SUM ( TableName[Mobile] ) ), [E&T] > 0 ) )