Sum of rows

Hello,

I am looking how to add values of some rows in order to reduce the row’s number.

For example:

I want to combine the rows 26+28+30+32 in one and to rename it.

Below is my table…

Thank you

Hi Angela_Dru,

one way might be selecting the rows you want to aggregate (rule-based rule engine to identify categories + row splitter to separate rows to be aggregated) and use a GroupBy node to sum the values. Then concatenate results.

RB

Thank you @lelloba but your answer is not very clair for me…
Should I use first rule engine node? If yes how to select the rows? I see only columns…

Try this: Sum of rows – KNIME Hub

Is it working for you? :slight_smile:
RB

How you managed column expression? Have no experience with this node…
how to assign the same number to rows…
a little bit tricky my post

In my solution, column expression is empty. It just creates a new column named “group”.
If you need to understand how to use it, I suggest you watch this video :slight_smile:

RB

You advised to assign the same number to rows ? How is possible?

I have assigned the same number to rows inside the Table Editor node.

If you double click on a cell you can edit it - just like in Excel.

Press enter to save the edited cell and when you close the window make sure to click on Apply as new default.

RB

Thank you, so first I have to create an additional column like your”group”

Exactly! First create, then populate :slight_smile:

Thanks, I managed

It’s a little “monkey work” because my data set has 400 rows…

but it’s an option anyway

I saw that there should be some kind of hierarchy inside the activity column.
Maybe you can just consider level 1 (eg Personal care activities) instead of sleeping, grooming and others. In this case, filter all level 2 activities and keep the main level (personal care activities, eating and drinking, household activities, etc.).

RB

Any ideas how to filter 2 level of activities?

I can use your method with Table editor, but it’s the same consuming of time.

As you can see, there is a certain number of spaces before a general category and a different number of spaces before the second-order category.

Count the number of spaces before the second-order category. Then go back here Sum of rows – KNIME Hub and inside the pattern cell of the Row Splitter node insert the number of spaces for the second-order category and an asterisk. Leave everything else as it is in the image below.

RB

Brilliant idea but I have no result
I tried till 6 spaces and no changes

Hi Angela,

Could you please share some data?

Thanks,
RB

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