Cost per usable casting
Calculate the cost of the batch and the price of a suitable casting.
Result
Add up the cost of components for the actual sample, consumables and packaging of the batch, divide by the number of suitable castings. If there are zero good ones, display only the batch costs.