Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello All,
I am having some trouble figuring out how to make a measure work correctly, I am trying to get the count of final failures in a process.
i have data in a table that records part number, serial number, result, pass(65) or fail (105). seems simple enough to use
Final Reject = CALCULATE(DISTINCTCOUNT(StationEventHist[PartSerialNbr]),StationEventHist[EventID]=VALUE(105))
however the process is structured where a serial number can fail multiple times for various reasons, get repaired and retested and then get a good result, leaving me counting rejects that were fixed or corrected
example:
SN Result
123 fail
123 fail
123 fail
123 pass
'
my formula yeilds final reject = 3 and final accept = 1
The goal is to have final reject count = 0 and final accept count = 1
Thank you!
Solved! Go to Solution.
Another approach that woudl work even If you don't have the date field suggested by jthomson.
You could staging tables of serial numbers that have passed and failed using summarize with filters to capure only passing adn failing NS's respectively and include other calculated or relevant columns as needed,
Passing SN = CALCULATETABLE(SUMMARIZE('StationEventHist',StationEventHist[PartSerialNbr]),'StationEventHist[EventID]<>65)
Reject SN = CALCULATETABLE(SUMMARIZE('StationEventHist',StationEventHist[PartSerialNbr]),'StationEventHist[EventID]<>105)
Then update you mesures to calculate form these tables and join the tables in your model by SN so any other filters you apply would work correctly.
Hi @Gschalk87,
Can you mark the proper answer as a solution please?
Best Regards,
Dale
sorry for delay! ended up digging into the current SQL Statement flow and folling its logic and the idea suggested, if it dosnt have a good test record, it must have a bad record. this matches the current system, but i may look into running stored procedure to use the exact method everyone on site is used to seeing.
Thank you for your help!
There's a few ways you could look at this depending on how exactly your data model works - if each SN can only pass once, you could do a distinct count of all the serial numbers, then do a count of the number of rows that have a result of pass and take one from the other, or if there's some sort of date/time field with each row, you could play with filters to just look at the most recent instance for any given SN (should be easy to search for the correct syntax)
Another approach that woudl work even If you don't have the date field suggested by jthomson.
You could staging tables of serial numbers that have passed and failed using summarize with filters to capure only passing adn failing NS's respectively and include other calculated or relevant columns as needed,
Passing SN = CALCULATETABLE(SUMMARIZE('StationEventHist',StationEventHist[PartSerialNbr]),'StationEventHist[EventID]<>65)
Reject SN = CALCULATETABLE(SUMMARIZE('StationEventHist',StationEventHist[PartSerialNbr]),'StationEventHist[EventID]<>105)
Then update you mesures to calculate form these tables and join the tables in your model by SN so any other filters you apply would work correctly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
83 | |
78 | |
54 | |
39 | |
35 |
User | Count |
---|---|
98 | |
80 | |
50 | |
48 | |
48 |