Sum of all rows of the same column above

Hi all,

I do search a solution to sum up numbers of a column and write the sum to the next column.
The sum in the next column should only sum up, all values of the original column until the ask row and above.

Maybe an example:

Column Values | Column Sum (to be calculated)
1 | 1
1 | 2
2 | 4
3 | 7
1 | 8
6 | 14

Anybody an easy help?
Thanks in advance!

Hi @Chris12345,
welcome to the Community.

You can use the moving aggregation node to solve it.

BR

1 Like

Hi @morpheus ,

Thanks for the fast answer. When i look at the moving aggregation node, I still dont get the point.
Could you please give me another hint, how to configure the node?

I see just options, to build sums of “column 1”. What I’m looking for is Sum(Column 1 + Column 2(one row above))

Not sure if I missed a point in that node…

BR
Chris

Or how can I implement a flexible windows length, to calculate the sum for each row, starting with the top row?

That’s the purpose of the Moving Aggregation Node.
Maybe you take a look at Moving Aggregation — NodePit
[Edit: Wrong node corrected]

1 Like

Hello @Chris12345,

and welcome to KNIME Community!

In case you haven’t managed to get it working here is configuration of Moving Aggregation node to get cumulative sum as asked for in first post:

If you are looking for something else (window length, summing values from different columns) data example would help to avoid guessing :wink:

Br,
Ivan

1 Like

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