cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Community Support

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

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

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

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

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.

In doing so, you are also helping me. Thank you!

Proud to be a Super User!

Community Champion

Hello,

Did you try using DISTINCTCOUNT instead of COUNTA?

Helper IV

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

Community Champion

Is [CallID] of type Boolean?

Helper IV

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

Community Champion

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:

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

Helper IV

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

Helper IV

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors