Structuring Table with a different number of rows in a column

I’m quite certain that this is a limitation of KNIME, but if there’s anything I’ve learned, it’s that people know the tool better than me. I’m working with a table (pictured below) that has an identifier column and 4 columns of numbers. The desired result is for the “Totals” column to contain the summed amount of all columns based on identifier. As a result, the totals column would have 6 rows. I have used a groupby node to produce the second table that demonstrates what I’m aiming for. I attempted to append the second table but received an error message “Tables can’t be joined, non matching row counts: 10 vs. 6.” This is what I was expecting and is why I think this might be unfeasible. Just curious if there is a solution or a clever work-around. Thanks in advance for your help.


Desired Total Column

Hi @JGebhard

You can use a Joiner node for this. Join on the most left column of both tables and retrieve the Sum(Totals) column.

Hey @ArgenEX, I went ahead and did that, but there’s still duplicate values of the total. It is not significant, but for the purpose of a cleaner output, is it possible to reduce the rows from 10 to 6, combining like rows into one?
Table Join

Hi @JGebhard

What should happen with the information in the rows then? What you could do is the groupBy node again, whereby column 1 is the group, column 2,3,4,5,6 are aggregated by Concatenate, and column 6 by Sum.

image

You could also opt for a Type based aggregation whereby the String columns are concatenated and the Double columns are summed.

1 Like

This is a creative solution for a work-around. Thanks!

2 Likes

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