Iterate through rows with specific attribute and perform a calculation

Hi everyone,

I would like to do some settling of an amount based on an id. As an example the following image is supposed to explain my problem:


There is a table with ids, an amount to be paid and a paid amount. I would like to iterate through each id and fill the rows with the settled amount of each position.
So e.g. for id=1 there are 60 paid which have to be split to all rows with id=1, the first row has an amount of 40, so the 60 are completely settling this amount, and there will be 20 left. The left over 20 should be carried on to the next row where 30 are open to be paid. So the 20 are settling a part of the open amount of this position.

Is there any way to solve this issue in KNIME?

Best regards

Hello @databreach and welcome to the forum.
I’m not sure if this is the most efficient way to solve it, but it worked, at least with the example data…

20221017_perform_row_calculation_in_groups.knwf (60.8 KB)


PS.- The reason for the IF Switch is: because the Moving Aggregation node doesn’t work with less than two rows.


Hi @gonhaddock,
Thanks a lot, your solution works perfectly for me!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.