Hi All
I need help for a query and my requirement is as below.
qty_needed qty_onhand
2 5
2 5
2 5
5 5
5 5
I want to replace the qty_onhand values with a cumulative difference to avoid repetitive value.
I need a query that will display the cumulative difference for example I have a value say 5 as the initial value of qty_onhand.
formula: qty_onhand - previous qty_needed
Qty_needed qty_onhand
2 5
2 5 - 2 = 3
2 3 - 2 = 1
5 1 - 2 = 0 should be zero because there are no remaining material onhand
5 0 - 5 = 0