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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Flammie
Helper I
Helper I

Count of Boolean

Hello, I have a boolean that looks at 2 conditions to make a decision. Then I have a measure that is supposed to count the number of "Failed" conditions. My count calculation keeps pulling both conditions instead of just one "fail". I have included both of my calculations as well as a screen shot of my results. What I want is for my "Count of Fail" to only count the number "Fail" words, not the number of failed conditions.

 

Here is what I want from the following DAX code (I only want the document to fail 1 time. Even if both conditions are met):

CONDITION: IF condition A is met then fail

                     IF condition B is met then fail

 

CODE: Pass/Fail = IF(OR(Rejected[Action] = "REJECTED", Rejected[Status Code] = "BACKWARD"),"Fail", "Pass")

 

Here is my Count of Fail code:

Count of Fail = CALCULATE(COUNT(Rejected[Pass/Fail]), FILTER(Rejected, Rejected[Pass/Fail] = "Fail"))
 
And here is the result I am getting. See where it says 2 when both conditions have been met? I only want it to fail one time no matter how many failures there are.

 

DocumentRejectedBackwardPass/FailCount of Fail
abc11Fail2
ded10Fail1
iek01Fail1
oow11Fail2
ytr00Pass0
1 ACCEPTED SOLUTION
Flammie
Helper I
Helper I

I ended up changing my counting formula.  I counted the number of documents that had a status of "Fail".

 

CALCULATE(DISTINCTCOUNT(Rejected[Change Number]), FILTER(Rejected, Rejected[Pass/Fail] = "Fail"))

View solution in original post

4 REPLIES 4
Flammie
Helper I
Helper I

I ended up changing my counting formula.  I counted the number of documents that had a status of "Fail".

 

CALCULATE(DISTINCTCOUNT(Rejected[Change Number]), FILTER(Rejected, Rejected[Pass/Fail] = "Fail"))
Greg_Deckler
Super User
Super User

Just use MAX instead of COUNT aggregation.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you. I forgot about the MAX and I will use that on another one of my issues but, that only returns the text "Fail". My result with using MAX is: Count of Fail = "Fail" I need a count of how many documents failed.

Oh, I was referring to MAX of your two numeric columns (1's and 0's). You can use MC Aggregations for that. 

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Multi-Column-Aggregations-MC-Aggregations/m-...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.