How to GroupBy 3 group columns only if another column's string matches column header

Hello everybody,

I am trying to GroupBy (Sum) column “Quantity” in “Column4” based on “Column1”, “Column2”, “Column3” only if the string of column “Date” matches “Column4”'s header (in my case a date e.g., = “2019-01-01” and “2019-02-01”). I have 72 “Column4”-type columns in total (i.e., every month from “2019-01-01” until “2024-12-01”). Is there any recommendation on how to best do this?

For an example please look at the attached picture below:
grafik

Many thanks in advance for your support - highly appreciated.
Isabell

I think you need the Pivoting node:

https://hub.knime.com/knime/nodes/Pivoting*ebLbPp7VLbV4apta

The group columns will be Column1/Column2/Column3, and the Pivot columns will be Date. Then you need to sort out your aggregation method, which looks like Sum of quantity. There is also a blog post which probably explains more clearly:

https://www.knime.com/blog/how-to-build-pivot-tables-a-vlog

Steve

2 Likes

Dear Steve,

Many thanks for your quick help - highly appreciated. Your proposed solution works perfectly.

Cheers,
Isabell

3 Likes

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