Problem with grouping

Hello there :smiley: I want to calculate the sum “a” in set. I think about looping, but no idea how to do this.

I have:
Zrzut ekranu (44)

I want:
Zrzut ekranu (45)

Hello @pjacob

I would be happy to have a go to this interesting question. For that, could you please post a minimalist workflow with the table ? I’ll provide you with the anwer in the same workflow.

Thanks & best regards,

Ael

1 Like

Hi @aworker thank for help :smiley:
knime_groupby.knwf (4.7 KB)

Hi @pjacob,

to get the expected result you need a additional key which define your table in subgroups. For example the first ABC get the subgroupid of 1 and all following a rows has the same value until the next ABC row appears and become the next greater value e.g. 2. Now you are able to use the groupby node to calculate the sum of column3.

In my opinion it is the simplest way to solve it but it depends strongly on the row order of your datatable.

BR

1 Like

Hello @pjacob,

Please find attached the solution. It illustrates the use of KNIME nodes such as “Math Formula” and “Moving Average” which are the kind of math operations that are needed to solve your special “GroupBy” case. Your question and this answer may hence be an opportunity to other Knimers to get familiar with these nodes. Hope you enjoy it and helps you too.

Best regards

Ael

20200409_PIKAIROS_GROUP_SPECIFIC_ROWS_USING_MOVING_AGGREGATION.knwf (54.1 KB)

3 Likes

@aworker thank you very much :smiley:

2 Likes

@pjacob thanks a lot for clicking on the heart :heart_eyes: and accepting the solution :grinning:!

2 Likes

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