Calculate column total of 'string' below each column

I have a column which is a boolean value true or false now I want the total of number of falses/true in the last row of that column, how is that possible?
I tried groubby and append but it is appending as a new column, but I need it at the bottom of the column as we do sum in excel for each cell.

A|B
True|True
True|False
True|True
True|True
False|True
False|False

Output
A|B
True|True
True|False
True|True
True|False
False|True
False|False
4 | 3

Any calculation would do either true or false.

1 Like

@AnotherFraudUser @iCFO Any suggestions?

Hi @hansa

Please be careful with directly tagging people one minute after you posted a question. This is usually not appreciated.

Anyway, to your question, you can solve this in a lot of different ways. Below are two options. Both involve some grouping. The first option takes about 35ms, the second one takes 39ms so from a performance point of view there is not real preference for one or the other. With the usual disclaimer that actual performance will depend on the size of the data in your actual use case, computer power, etc.

The output is in line with your expected.

Note: I think you made a typo in row 4 because it’s different but I assumed it to be false.

See WF:
Calculate column total of ‘string’ below each column.knwf (33.1 KB)

Hope this helps!

5 Likes

I will take a look in KNIME later, but my first instinct is GroupBy unique with count and then concatenate it to the bottom row.

3 Likes

Looks like @ArjenEX beat me to the reply button by a few seconds with the full uploaded workflow solution! Nice.

1 Like