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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jdelmonico
Frequent Visitor

Count Groups that contain at least one of a certain value in another column

I have different tests grouped together, and I want to count the number of groups where one or more tests has failed. I don't have access to manipulate the query or add columns, so I am trying to do this in DAX. My data looks like this:

 

Group

Test

Test Result

Group 1Test 1Fail
Group 1Test 2Pass
Group 2Test 1Pass
Group 2Test 2Pass
Group 3Test 1Fail
Group 3Test 2Fail

 

So for my outcome I essentially want:

Groups with Failed Tests: 2

Groups with No Failed Tests: 1

 

Thank you very much!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @jdelmonico 

please try

Fail Count =
SUMX (
VALUES ( 'Table'[Group] ),
INT ( "Fail" IN CALCULATETABLE ( VALUES ( 'Table'[Test Result] ) ) )
)

 

Not Fail Count =
SUMX (
VALUES ( 'Table'[Group] ),
INT ( NOT ( "Fail" IN CALCULATETABLE ( VALUES ( 'Table'[Test Result] ) ) ) )
)

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @jdelmonico 

please try

Fail Count =
SUMX (
VALUES ( 'Table'[Group] ),
INT ( "Fail" IN CALCULATETABLE ( VALUES ( 'Table'[Test Result] ) ) )
)

 

Not Fail Count =
SUMX (
VALUES ( 'Table'[Group] ),
INT ( NOT ( "Fail" IN CALCULATETABLE ( VALUES ( 'Table'[Test Result] ) ) ) )
)

Thank you for the suggestion! It might work, but I'm not sure--when I tried it I got an error that it took too much memory! It's a very large dataset.

 

jdelmonico_0-1686075355300.png

 

Nevermind! I had a typo in there that was throwing the calculation off! I have fixed it and this appears to work!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.