Forum Discussion

JRowe's avatar
JRowe
New Member
4 years ago
Solved

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?

 

ContactIDIDEmailMobile
1110
2110
3101
4210
5201
6201
7310
8310
9310
  • 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
        )
    )

2 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    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
        )
    )
    • JRowe's avatar
      JRowe
      New Member

      tamerj1 that's really brilliant and worked perfectly. I was having trouble putting on filters that accounted for both email and mobile, so great solution