Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 1 | Test 1 | Fail |
Group 1 | Test 2 | Pass |
Group 2 | Test 1 | Pass |
Group 2 | Test 2 | Pass |
Group 3 | Test 1 | Fail |
Group 3 | Test 2 | Fail |
So for my outcome I essentially want:
Groups with Failed Tests: 2
Groups with No Failed Tests: 1
Thank you very much!
Solved! Go to Solution.
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] ) ) ) )
)
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.
Nevermind! I had a typo in there that was throwing the calculation off! I have fixed it and this appears to work!
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |