Basically I'm trying to find the defect percentage per "Defect Code."
The machine number is in one table ([Knitting]) and the defect code/defect quantity are in another table ([Knitting Defects]). They are related by piece number and are being affected by a calendar table. Processed Qty is from the Knitting Defects table as depicted below.
Problem is when applying the percentage calculation below, it works perfectly for the machine, but the percentage of the parts (defect codes) come out as 100%.
I have three DAX measures that I'm using currently.
Defect Quantity =
CALCULATE(
SUMX( 'Knit Defects','Knit Defects'[Processed Qty]),
left('Knit Defects'[Defect Code])="5"
)
Defect and 1st Quality =
calculate(
sum('Knit Defects'[Processed Qty]),
'Knit Defects'[Defect Code] = ""
) + [Defect Quantity]
Defect Percentage =
iferror([Defect Quantity] / [Defect and 1st Quality] ,0)