PartTran BAQ: Calculating the "Running Total" of the History Tracker

@Alice_Elizabeth

Make a CalcField SignedTranQty with expression

(case  
    when PartTran.TranType IN ('STK-ASM', 'STK-CUS', 'STK-INS', 'STK-KIT', 'STK-FAM', 'STK-MTL', 'STK-PLT', 'STK-STK', 'STK-UKN', 'STK-DMR') then -1 
    when PartTran.TranType IN ('ADJ-CST', 'ADJ-QTY', 'AST-STK', 'DMR-STK', 'INS-STK', 'MFG-STK', 'PLT-STK', 'PUR-STK', 'STK-STK', 'SVG-STK')  then 1 
    else 0
end) * PartTran.TranQty

Then another Calc field RunningQOH with the expression

SUM(SignedTranQty) OVER (Order By PartTran.TranNum)

Edit

You don’t need to select the GroupBy box on the other fields like you would with a plain SUM() function.

7 Likes