Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Vanessa250919
Helper IV
Helper IV

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 
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Vanessa250919 ,

 

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

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

1.PNG 

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

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

9 REPLIES 9
v-jayw-msft
Community Support
Community Support

Hi @Vanessa250919 ,

 

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

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

1.PNG 

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

2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
PaulDBrown
Community Champion
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.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






PC2790
Community Champion
Community Champion

Hello,

 

Did you try using DISTINCTCOUNT instead of COUNTA?

Yes but it's not Ok with true or false values . 

Is [CallID] of type Boolean?

Can you please share your sample data please?

Nope, I need number of disctinct call ID when Rona answered is TRUE or FALSE 

 

Vanessa250919_0-1614162914545.png

 

Then it should work, as you are trying to apply Count operation on CallID which is a non- boolean column, it won't have any issue.

See a small example I have done:

PC2790_0-1614164142962.png

Two measures I created:

Count with COUNTA = CALCULATE(COUNTA('Table'[CallID]), FILTER('Table','Table'[Roma Answered]= TRUE()))

Outcome- 5

 

Count with DistinctCount = CALCULATE(DISTINCTCOUNT('Table'[CallID]),FILTER('Table','Table'[Roma Answered] = TRUE()))

Outcome-4

You can further do the required customizations

 

Thanks for your help, I try to add my other values like in bellow but it doent"s work 

Vanessa250919_0-1614168878064.png

 

I think I can make to calculate with boolean values in powerBI, always one issue message .

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.