Forum Discussion

Vanessa250919's avatar
5 years ago
Solved

Count Disctint in DAX boolean values

Hello All, 

 

I try to make a new DAX function in my dataset :

 

# Answered Queue + Rona =
CALCULATE (
COUNTA ( 'FACT Interaction Segment'[Call ID] ),
'FACT Interaction Segment'[Rona Answered] = TRUE ()
)
+ CALCULATE (
COUNTA ( 'FACT Interaction Segment'[Call ID] ),
'FACT Interaction Segment'[Queue Answered] = TRUE ()
)
 
But I need a Distinct count return for [Call ID], is it possible ? 
 
Thanks 
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Vanessa250919 ,

     

    It's ok to count boolean values. Try this measure.

    Measure = CALCULATE(DISTINCTCOUNT('Table'[id]),FILTER(ALL('Table'),'Table'[boolean]=TRUE()))

     

    In your formula you have missed the ")" after "true())".

     

    Best Regards,

    Jay

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Vanessa250919 ,

     

    It's ok to count boolean values. Try this measure.

    Measure = CALCULATE(DISTINCTCOUNT('Table'[id]),FILTER(ALL('Table'),'Table'[boolean]=TRUE()))

     

    In your formula you have missed the ")" after "true())".

     

    Best Regards,

    Jay

  • PC2790's avatar
    PC2790
    Community Champion

    Hello,

     

    Did you try using DISTINCTCOUNT instead of COUNTA?

      • PC2790's avatar
        PC2790
        Community Champion

        Is [CallID] of type Boolean?

        Can you please share your sample data please?

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Vanessa250919 

    One way is to convert the boolean value to an integer:

    INT(TRUE()) returns a value of 1 If true or blank if false. So use this expression in measure (instead of TRUE()) and then you can simply sum the values.