Add current row value (different col) to previous row value to derive current row value new column

I am at the end of the rope to build this logic. I can see that I need Lag Column here but unable to come up with the logic.

I have a variable set to a value say 35000

ROW1 1
ROW2 1
ROW3 2
ROW4 1
ROW5 3
ROW6 1

I am looking to add new column which is variable value + number in row for the first row and then running sum carrying forward.

ROW1 1 35001 (35000 + 1)
ROW2 1 35002 (35001 + 1)
ROW3 2 35004 (35001 + 2)
ROW4 1 35005 (35004 + 1)
ROW5 3 35008 (35005 + 3)
ROW6 1 35009 (35008 + 1)

I hope I was able to explain :slight_smile:

Can someone come up with a best Knime approach for this.

Hi @jaydeep1

One possible solution is to use the “Moving Aggregation” node with -Cumulative Computation- before a “math” node:

image

20210818 Pikairos Add current row value to previous row value to derive current row value new column.knwf (16.5 KB)

Hope this helps,

Ael

4 Likes

Worked perfectly!!!

Thanks so much @aworker

3 Likes

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