Skip to main content
cancel
Showing results for 
Search instead 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

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
Europe Fabric Conference

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 Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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