Using loop to sum up continuous columns

Hi all,

I would like to use loop to sum up every two continuous spending and opt out any ID with sum less than 50. Data as below. (S stands for Spending)

ID S1 S2 S3 S4 S5
1 20 10 30
2 10 120 25 35
3 16 23 102 20 5
4 15 28
5 70 32 13 18

Any suggestions would be greatly appreciated!

Use column aggregator node and then row filter node.

Hi
From my understanding, column aggregator can only sum up all spending at a time instead of every two consecutive columns. (eg. sum s1 & s2 then sum s2 & s3, and etc.)

I would like to know what type of loop and iterations I should use to achieve this. Thanks!

Use Chunk Loop for rows and Column Loop for columns.

I attached an example that collects every two columns per row S1 and S2 => S1_S2, S2 and S3 => S2_S3 and so on. You could insert a rule that excludes any unwanted columns. If you wanted to have column sums it might be possible to adapt the workflow.

Maybe you could have a look and change you example accordingly.

kn_example_loop_sum_columns.knwf (71.6 KB)

1 Like

Thank you! That works amazingly!