Combining single columns from multiple sets in a loop

Hello,

I am looking for some help please. I am trying to combine multiple columns in a loop but only in specific combinations. For example, I need to calculate the sum of 3 columns, but only taking one column from each ‘set’ (named as Column_1, Column_2, Column_3). So Column_1a + Column_2a + Column_3a, then next calculate Column_1a + Column_2b + Column_3a, then Column_1a + Column_2c + Column_3a for every combination from the following:
Column_1a Column_1b Column_2a Column_2b Column_2c Column_3a Column_3b Column_3c Column_3d Column_3e.

I have copied what i expect to get below (summed values in bold) and have also have attached an Excel file with the same data.


KNIME_example data for loop.xlsx (9.5 KB)

I have looked at other help topics but can’t quite figure out how to do this with my data set.

Thanks in advance!

hi @Donna_Macmillan welcome to the community.
my loop approach and determine if it meets your desired outcomes.
image
KNIME_comb-cols-MM-2.knwf (163.3 KB)
apologize if this is not what you are expected.
rgds
linux knime 5.1.x

3 Likes

Thank you so much!! This worked perfectly.

2 Likes

Hello @Donna_Macmillan,

this was interesting as sometimes it’s not that straightforward to apply such logic in KNIME. Here is what I got:

First part is to create all combinations using row filtering and cross joining. Then I used String Manipulation to create expressions for Math Formula which were used in a loop. Workflow is attached.

columnSumCombinations_ipazin.knwf (35.7 KB)

Welcome to KNIME Community!

Br,
Ivan

4 Likes

Thank you so much!! Really appreciated.

1 Like

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