The Unpivot transformation component converts columns into rows by transforming wide data into long format. The unpivot component is the inverse of the pivot component and is useful for restructuring data where you want to transform multiple columns into row-based format, making it easier to analyze and compare values across different attributes.
Configuration
1. Unpivot Properties
![thumbnail image]()
Columns to narrow
Select the columns that should be converted from columns to rows. These columns will be transformed into rows with the column name stored in one column and the value stored in another column.
Attribute column
Specify the name for the column that will store the original column names (attribute names). This column will contain the names of the columns that were unpivoted.
Values column
Specify the name for the column that will store the values from the unpivoted columns. This column will contain the actual data values.
Example 1
Input data (Sales by Product and Quarter):
| Product |
Q1 |
Q2 |
Q3 |
Q4 |
| Widget A |
1000 |
1200 |
1100 |
1300 |
| Widget B |
800 |
900 |
850 |
950 |
| Widget C |
1500 |
1600 |
1550 |
1650 |
Unpivot configuration:
- Columns to narrow: ["Q1", "Q2", "Q3", "Q4"]
- Attribute column: "Quarter"
- Values column: "Sales"
Output data:
| Product |
Quarter |
Sales |
| Widget A |
Q1 |
1000 |
| Widget A |
Q2 |
1200 |
| Widget A |
Q3 |
1100 |
| Widget A |
Q4 |
1300 |
| Widget B |
Q1 |
800 |
| Widget B |
Q2 |
900 |
| Widget B |
Q3 |
850 |
| Widget B |
Q4 |
950 |
| Widget C |
Q1 |
1500 |
| Widget C |
Q2 |
1600 |
| Widget C |
Q3 |
1550 |
| Widget C |
Q4 |
1650 |
Example 2
Input data (Student scores by subject):
| Student_ID |
Science |
History |
Math |
English |
| 1 |
85 |
92 |
88 |
90 |
| 2 |
78 |
88 |
92 |
85 |
| 3 |
90 |
95 |
95 |
93 |
Unpivot configuration:
- Columns to narrow: ["Science", "History", "Math", "English"]
- Attribute column: "Subject"
- Values column: "Score"
Output data:
| Student_ID |
Subject |
Score |
| 1 |
Science |
85 |
| 1 |
History |
92 |
| 1 |
Math |
88 |
| 1 |
English |
90 |
| 2 |
Science |
78 |
| 2 |
History |
88 |
| 2 |
Math |
92 |
| 2 |
English |
85 |
| 3 |
Science |
90 |
| 3 |
History |
95 |
| 3 |
Math |
95 |
| 3 |
English |
93 |
Important notes
- Unpivot is the inverse operation of Pivot - use unpivot to convert columns back to rows
- Use unpivot when you need to normalize data from wide to long format