I’m having issues calculating the total confirmed quantity on a production order based on the largest production order line number.
The image above highlights 2 production orders. 13130 and 13046.
For Prod Ord 13130 the largest (or maximum Prod Ord Line) is 110. For this particular line number the confirmed qty shows as 0, 1, & 9, giving a total of 10 as seen in the Actual Conf Qty column, however my measure Confirmed Qty is returning 9
Likewise for Prod Ord 13046 the largest (or maximum Prod Ord Line) is 110. In this case the confirmed qty shows as 4 & 6, giving a total of 10 as seen in the Actual Conf Qty column, however my measure Confirmed Qty returns 9.
It would appear whenever we have multiple lines of a Prod Ord and Prod Ord Line, the measure only returns the maximum value in our case for Prod Ord 13130 = 9 & Prod Ord 13046 = 6. So how do we capture all the corresponding values of so that Prod Ord confirmed qty returns the correct values
My DAX measure is per following
Confirmed Qty =
VAR _OpNo = MAX( 'Conf Qty'[Prod Ord Line])
VAR _ConfirmedQty =
SUMX(
ADDCOLUMNS(
SUMMARIZE(
'Conf Qty',
'Conf Qty'[Prod Ord],
"@OpNo" , _OpNo
) ,
"@ConfirmedQty" , [Max Conf Qty]
) ,
[@ConfirmedQty]
)
RETURN
_ConfirmedQty
Max Conf Qty = MAX( 'Conf Qty'[Conf Qty] )
Attached is my Power BI file and Excel csv
JR
Conf Qty Rev-1.xlsx (14.5 KB)
Confirmed Qty Rev-1.pbix (24.8 KB)