Unpivot
Merges one or more columns into key and value columns
Last updated
Merges one or more columns into key and value columns
Last updated
The Unpivot node allows you to convert columns in your data table into row values. It involves converting wide-format data with multiple columns for different categories or attributes into long-format data, where each category or attribute is represented in a single row.
Select the columns that you want to unpivot into rows. All columns' names will be stored in one column and their values in another.
Enter a name for the new column to store the names of the unpivoted columns.
Enter a name for the new column to store the values from the unpivoted columns.
Switch this toggle "on" to keep columns that were not unpivoted.
Consider the following wide-format dataset:
Country | Year | Product_A_Sales | Product_B_Sales | Product_C_Sales |
---|---|---|---|---|
USA | 2021 | 1000 | 2000 | 1500 |
UK | 2021 | 800 | 1700 | 1200 |
France | 2021 | 900 | 1900 | 1300 |
The result of Unpivot:
Country | Year | Product | Sales |
---|---|---|---|
USA | 2021 | Product_A | 1000 |
USA | 2021 | Product_B | 2000 |
USA | 2021 | Product_C | 1500 |
UK | 2021 | Product_A | 800 |
UK | 2021 | Product_B | 1700 |
UK | 2021 | Product_C | 1200 |
France | 2021 | Product_A | 900 |
France | 2021 | Product_B | 1900 |
France | 2021 | Product_C | 1300 |