Use Moving Aggregation node first for Quantity used column based on a quantity column (preliminary calc).
Lag Column node to Data and use
Math Formula Multi columns to calculate Quantity Used (add lagged column) and Calculate quantity using Data column and Quantity used.
its hard to read your question.
Please can you explain it with an example shown as a table or if you have the calculation available in a Excel spreadsheet you can also upload this example file.
adding an additional column is not the problem. But i don’t get the role of the column data, which seems to drive your final outcome. Your explanation and the example is not very helpful.
For your understanding how java scripts has to be defined i added in the attached example the Column “target” in the source table and the calculation for the column “Extra” in the Java snippet. Comparing with the previous example you can see how the java snippet works.
what happens in the case that Extra equals null?
Please consider the depencense of the data and therefore the correct assignment (order of statements).
Run the java node and you’ll get the result and see whats happens.