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
Crawf8
Frequent Visitor

Combine and count results

Hi,

 

I'm trying to do something which I think should be pretty simple, but I'm having no luck figuring it out.

 

I have a table of test results from a calibration database.

Each device that is calibrated has multiple sensors. During calibration, some sensors are given multiple tests, my data looks like the first table on the left, shown below.

 

Crawf8_0-1670326787100.png

 

If any one of the tests on a sensor fails then the sensor is a fail, regardless of whether it passed the other tests. I've tried to capture this in the diagram above. The table on the right is an illustration, I don't have this table in my dataset.

 

I'm trying to create a measure that counts the number of fails and passes per sensor, as per the table on the right.

 

Crawf8_1-1670326262557.png

 

Does anyone know how this might be achieved? Thanks.

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Crawf8 

create the measures below,

Pass = COUNTX(FILTER('Table','Table'[Sensor Type]=MAX('Table'[Sensor Type]) && 'Table'[test_result]="PASS"),[test_result])
FAIL = COUNTX(FILTER('Table','Table'[Sensor Type]=MAX('Table'[Sensor Type]) && 'Table'[test_result]="FAIL"),[test_result])+0

result

vxiaotang_0-1670393977705.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @Crawf8 

create the measures below,

Pass = COUNTX(FILTER('Table','Table'[Sensor Type]=MAX('Table'[Sensor Type]) && 'Table'[test_result]="PASS"),[test_result])
FAIL = COUNTX(FILTER('Table','Table'[Sensor Type]=MAX('Table'[Sensor Type]) && 'Table'[test_result]="FAIL"),[test_result])+0

result

vxiaotang_0-1670393977705.png

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Brilliant. Thank you.

 

Why is there a '+0' a the end of the FAIL measure?

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.

Top Solution Authors