Repeat Moving Aggregation after each NULL

Hey all,

I try to get a solution for a really simple task actually but somehow I dont find it.


I just want to have a running sum of the key column that repeats after each row with a NULL.
So Index 77 has the Value 1, Index 78 has the value 2 and 80 starts with a 1 again.

Can anyone help me with this task?

Thank you in Advance :slight_smile:

Hi @Robinvm

You could use a moving aggregation to cumulative sum the 1 in the Key column to produce a new column containing the sequence numbers

This would generate something like this (using my own sample data)

You can then remove the additional duplicated numbers with a Rule Engine

which would give you the data in a new column that you can then filter/rename


Thank you for your answer! I already tried it - The problem is, that I need at Index 12,13,14 not the values 3,4,5 but 1,2,3…

Ah sorry @Robinvm , my bad I misread your initial post.

Try this:

rank blocks.knwf (18.9 KB)


Thank you :smiley: I thought to complicated

Hi @Robinvm , you’re welcome and thank you for marking the solution.

You may be interested to know that I have been looking at how to create a “framework” where such cumulative calculations could be achieved more easily and have attached a demonstration workflow that uses this framework. The framework consists of the addition 3 components and a recursive loop; none of which require configuration but simply need to be joined together in a standard way.

For your challenge, it could be written like this

rank blocks - using Cumulative Framework components.knwf (82.5 KB)

The rules and calculations for solving your challenge are placed in the Rule Engine and Math Formula nodes and are simply:


resulting in:

The components and another demo workflow are available here:

1 Like

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