Converting some columns content into new columns and column value

Hello,

I hope the title of this topic makes sense.
I have a table with four columns. I want the content of column 3 to become new columns, and at the same time the content of column 4 becoming the value of the new columns.

It should look like this

Before:

ID Group Question Value
789 Red A 1
790 Red B 2
791 Red C 3

After:

ID Group A B C
789 Red 1
790 Red 2
791 Red 3

I tried Pivoting, Unpivoting, Transpose… but nothing worked. Maybe I’m making a mistake or tried just the wrong nodes.

Can anyhelp help?

Marco

1 Like

Hello @aworker and @mkoch,

isn’t just Pivoting node enough? ID and Group columns are group column, Question is pivoting column and First aggregation on Value column?

Br,
Ivan

3 Likes

Hello @ipazin

My apologies, you are right :wink: !

I forgot to copy the ID in the previous version (withdrawn now). I’m posting soon a fixed version :slight_smile:

Thanks a lot @ipazin for spotting the error !

Best,

Ael

3 Likes

Hello @mkoch & @ipazin

Please find attached a workflow with a possible solution:
20210617 Pikairos Converting some columns content into new columns and column value.knwf (29.6 KB)

Pivoting node configuration is given in the snapshot :wink:

Hope this helps,

Ael

5 Likes

Hi Ael,

that’s it! I handled the Pivoting Node wrong. Now it is perfect.
Thank you very much. I just love the KNIME comunity!!! :slight_smile:

2 Likes

Hi Marco

Thanks a lot for your nice comments and for validating the solution !

Thanks a lot too to @ipazin who quickly spotted my mistake and provided hints !

Best wishes to both :smiley: !

Ael

3 Likes

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