sum multiple column in knime

Hello Knime Expert,

I have four column in a excel file I want sum all those four column & create a new column. Can anyone please help!!

Thanks!

  • last four column I want to sum

Example -
col-1|col-2|col-3|col-4 new_col
2 | 3 | 5 | 7 17

Hello @jaydeb91,

you are looking for Column Aggregator node:

Br,
Ivan

4 Likes

@ipazin thanks for your quick response.
I have tried with that note but not getting SUM function. Can you explain the steps please

Hi @jaydeb91 ,
‘Math Formula’ or 'Math Formula (Multi Column)

$Prod_S...$ + $shippin...$ + $Promo...$ + $Sales tax$

BR

1 Like

Hi @gonhaddock I have tried that but unfortunately all those four column are not visible in math formula (multi column) note.

@jaydeb91
Because 3 of them are in string format. You may have to convert them into numeric before.
‘String to Number’

1 Like

this is a csv file when using string to number note it shows error.

please find the attached workflow for your perusal.Sales data.knwf (20.1 KB)

Hi @jaydeb91

There is no data in your exported wf, because you did not uncheck “Reset workflow(s) before export”.
image.
gr. Hans

Sorry !! pls find the attached workflow Sales data2.knwf (2.8 MB)

1 Like

Hi @jaydeb91

You need the String to Number node to convert your 4 columns from string to number. After that you can use the Column Aggregator as @ipazin suggested.


gr. Hans

3 Likes

@ipazin @HansS @gonhaddock thanks for your help :grin:

3 Likes

Glad you (we) made it @jaydeb91.
Also it’s good you are marking your topics as solved but note that it makes sense to mark reply that solves your issue as Solution. Other reason for this except for common sense is that reply marked as Solution is linked in first post. This then helps other users navigate to solution faster. (@HansS’s previous answer seems appropriate to me :slight_smile: )
Ivan

1 Like