How to transpose/pivot only a single column

Hello everybody,

this is my first post in this forum and I really hope that I am doing everything according to the guidelines :slight_smile: I have an issue that I cannot seem to solve myself and could not find the soulution in this forum. So, I hope that somebody is able to help me:

I have a database where there are several datasets for products. These datasets only differ in their “Amount used” value while per product, the values “Product” and “Sugar?” are always the same:

image

Now I would like to transpose the “Amount used” column, so that I only get one column per value and only end up with two datasets:

image

I played around with the pivot node but it seems that I cannot get the settings right and I am not even sure that it is the correct node to use, since I don’t want to aggregate any values.

Thanks a lot!

Cheers,
Tobi

Hi @SirTobi

Welcome to the KNIME community!

A way to approach this is to use a GroupBy based on Product and Sugar. This way, you can create a list of Amounts that you can split to individual columns subsequently.

image

Note: for reference I kept the original list in there. You can also opt to have it removed in the Cell Splitter node.

image

WF: How to transpose pivot only a single column.knwf (28.6 KB)

Hope this helps.

3 Likes

Yes, it works perfectly!! Thank you so much!!

1 Like

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