This is a continuation of a previously closed topic. Refer to https://forum.enterprisedna.co/t/calculate-associated-total-costs-of-context-in-reverse-order/12987/5
After doing more analysis, it turns out that we are correctly calculating the rejects costs when we have a single occurrence of a reject on a production order. In the image below we are showing the Reject table
As you can see the first record for Order A11682 Op No 50, we lost 15 parts for LEAK, the Cumulative Correct Reject Costs 2 measure returns $393.81, this is correct.
However looking closer where multiple rejects occurred on the same production order we seem to have incorrect values for Cumulative Correct Reject Costs 2 measure. The image below is from the Confirmed table.
To this table I added an additional measure named Cumulative Std Costs Unit 1.
Cumulative Std Costs Unit 1 =
VAR _CurrentOrder =
SELECTEDVALUE ( Confirmed[Order] )
VAR _CurrentOpNO =
SELECTEDVALUE ( Confirmed[Op No] )
VAR _MaxOPNo =
MAX ('Confirmed'[Op No] )
VAR _CumulativeStdCosts =
SUMX (
CALCULATETABLE (
SUMMARIZE (
Confirmed,
Confirmed[Activity Type],
Confirmed[Matl No],
Confirmed[Op No],
Confirmed[Order],
Confirmed[Std Rate]
),
Confirmed[Op No] <= _MaxOPNo,
Confirmed[Order] = _CurrentOrder,
REMOVEFILTERS ( Confirmed )
),
[Std Costs Unit 1]
)
VAR Result = _CumulativeStdCosts
RETURN
Result
This calculates the accumulated standard costs from the first Op No to the last Op No for each production order. Very quickly you can see that for Order A11909 Op No 130 we have $43.30, whereas in the Reject table for the same order number we have 4 separate rejects, 3 of which are tied to Op No 130. As you can see the Cumulative Correct Reject Costs 2
Cumulative Correct Reject Costs 2 =
VAR _CurrentOrder =
SELECTEDVALUE ( 'Rejects'[Order] )
VAR _CurrentOpNO =
SELECTEDVALUE ( Rejects[Op No] )
VAR _MaxOPNo =
SELECTEDVALUE( Rejects[Op No] )
VAR _RejectQty =
SELECTEDVALUE( 'Rejects'[Qty] )
VAR _CumulativeStdCosts =
SUMX (
CALCULATETABLE (
SUMMARIZE (
Confirmed,
Confirmed[Activity Type],
Confirmed[Matl No],
Confirmed[Op No],
Confirmed[Order],
Confirmed[Std Rate]
),
FORMAT('Confirmed'[Op No], "@") <= _MaxOPNo ,
//Confirmed[Op No] <= _MaxOPNo,
Confirmed[Order] = _CurrentOrder,
REMOVEFILTERS ( Confirmed )
),
[Std Costs Unit 1]
)
VAR Result = _RejectQty * _CumulativeStdCosts
RETURN
Result
has returned…
$ 122.54 for qty 8 rejected for Depth … should be $43.30 * 8 = $364.40
$275.72 for qty 18 rejected for O/S … should be $43.30 * 18 = $779.40
$61.27 for qty 4 rejected for Depth … should be $43.30 * 4 = $173.2
and finally for Op no 140…
$15.84 for qty 1 rejected for Depth … should be $43.82 * 1 = $43.82
I pondered this for some time yesterday, trying different variants of the
Cumulative Correct Reject Costs 2 measure but was unsuccessful in resolving. I also checked my production model and I see the same issue.
I have attached the latest .pbix file
Not sure of where to go from here, as I’d previously stated we had a solution for the posting.
Best Regards
J
Example 1 Rev-4.pbix (385.9 KB)