Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Measure result based on OR conditions

  Hi Community,   In the following dataset, I created a measure that counts distinct clients where contact type <> "EM" || val1 <> 'Y'|| val2<>"Y". Measure = CALCULATE ( DISTINCTCOUNT ('Tabl...
  • TomMartens's avatar
    4 years ago

    Hey Anonymous ,

    the measure is a little more complex:

    Measure 2 = 
    var t_not_EM = 
        CALCULATETABLE(
            VALUES( 'Table'[Client] )
            ,'Table'[Contact Type] <> "EM"
        )
    var t_EM = 
        CALCULATETABLE(
            VALUES( 'Table'[Client] )
            ,'Table'[Contact Type] = "EM"
        )
    var notEM =
        EXCEPT(
            t_not_EM
            , t_EM
        )
    var t_VAL1_VAL2 = 
        EXCEPT(
            CALCULATETABLE(
                VALUES( 'Table'[Client] )
                ,'Table'[Val1] = "N" || 'Table'[Val2] = "N"
            )
            , notEM
        )
    return
        COUNTROWS(
            UNION(
                notEM
                , t_VAL1_VAL2
            )
        )


    Based on the measure you get this result on a card visual:

    If you use CONCATENATEX instead of COUNTROWS you will get this on the card visual:

    ...
    CONCATENATEX(
            UNION(
                notEM
                , t_VAL1_VAL2
            )
            , 'Table'[Client]
            , " | "
        )

    The card visual:

    Hopefully, this provides what you are looking for.

    Regards,
    Tom