Forum Discussion
Failure rate running total based on counted fields
Hi,
I'm trying to calculate a running total of a count of product failures over a count of products shipped:
| Count of Failures | Count of Shipped | Wrong | Correct | Methodology | |
| June | 1 | 100 | 1.0% | 1.0% | 1/100 |
| July | 5 | 100 | 5.0% | 3.0% | 6/200 |
| August | 15 | 100 | 15.0% | 7.0% | 21/300 |
| September | 10 | 100 | 10.0% | 7.8% | 31/400 |
When I create a measure: Failure rate = COUNTA('Case_Serial_Number'[Failure_Type]) / COUNTA('Serial_Numbers'[Serial]) - I get the failure rate for that month (the wrong column above). The calculation needs to take into account the specific months failures and shipped quantities and all the failures and shipped that preceded it. Thanks.
3 Replies
- Interkoubess
Solution Sage
Hi macemit,
I changed the field names ( to Shipped and Failed) and table name ( Table) and I created a date ( first date of every month) and finally created this measure:
Per = var CounFail = CALCULATE(SUM('Table'[ Failures]),FILTER(ALL('Table'[Date]),'Table'[Date]<=MAX('Table'[Date]))) var CounShip = CALCULATE(SUM('Table'[Shipped]),FILTER(ALL('Table'[Date]),'Table'[Date]<=MAX('Table'[Date]))) return DIVIDE(CounFail,CounShip,BLANK())Hope it helps....
Ninter
- macemitFrequent Visitor
Thanks for that. I was away from the office for a couple days hence the delay responding. Question: can I use counta instead of sum, as the fields are text and cannot be summed.
And 1 issue: serial number and failures came from 2 different tables. Is this how your measure is calculating? I'm getting a 'syntax for 'return' is incorrect'
Thanks.
- Ashish_Mathur
Super User
Hi,
Share the link from where i can download your PBI file.