Cumulative ROW SUM With Multiple Conditions HELP PLEASE

I have a Table With the following information
CITY--------- CODE------------- DATE -------------Quantity
SP ----------- A001 -------- 01_01_2018 ----------- 30
SP ----------- A001 -------- 02_01_2018 ----------- 40
SP ----------- A002 -------- 01_01_2018 ----------- 50
SP ----------- A002 -------- 02_01_2018 ----------- 60
RJ ----------- A001 -------- 01_01_2018 ----------- 30
RJ ----------- A001 -------- 02_01_2018 ----------- 40
RJ ----------- A002 -------- 01_01_2018 ----------- 50
RJ ----------- A002 -------- 02_01_2018 ----------- 60

I need to create a column with the cumulative sum for row with the same year, local, code and POSTING DATE smaller

Reason to stablish if the delivery is going to deposit A or B, depending on how much the city`s total after delivery.
CITY--------- CODE------------- DATE -------------Quantity----------- Cumulative
SP ----------- A001 -------- 01_01_2018 ------------ 30 -------------------- = 30
SP ----------- A001 -------- 02_01_2018 ------------ 40 -------------------- (30+40) = 70
SP ----------- A001 -------- 03_01_2018 ------------ 20 -------------------- (30+40+20) = 90
SP ----------- A002 -------- 01_01_2018 ------------ 50 -------------------- = 50
SP ----------- A002 -------- 02_01_2018 ------------ 60 -------------------- (50+60) = 110
RJ ----------- A001 -------- 01_01_2018 ------------ 30 -------------------- = 30
RJ ----------- A001 -------- 02_01_2018 ------------ 10 -------------------- (30+10) = 40
RJ ----------- A002 -------- 01_01_2018 ------------ 50 -------------------- = 50
RJ ----------- A002 -------- 02_01_2018 ------------ 50 -------------------- (50 +50) = 100

Welcome to the KNIME forum.
You can try


node.

4 Likes

Hi @taynahmayara

I think using the Moving Aggregation node within een Group Loop node will help you out. See: row_sum_cumulative.knwf (32.7 KB)


gr. Hans

6 Likes

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