Use case
This component is useful if you need to transform a wide dataset into a long format, which is often more suitable for further analysis. For example, you can use it to transform monthly columns of sales data into a long format with one column for months and another for sales data.Properties
A human-readable name for the component.
Select the columns in the source table to narrow into a single pivot column. The names of these columns will populate one new output column, the values of these columns will populate another new output column. The names of these new columns are dictated by the ‘Output Names Column Name’ and ‘Output Values Column Name’ properties.
Assign a name to the generated column that will be populated with the names from the columns in the column list.
Assign a name to the generated column that will be populated with the values from the columns in the column list.
Examples
- Example 1
- Example 2
Goal: Unpivot monthly sales data into a single columnWe have a table of sales data that shows how many of each product type were sold each month. Let’s use the Unpivot component to transform the monthly columns into a single Month column.Input data
Component configuration:
If you read Example 1 in our Pivot component guide, you will see that although we have unpivoted the data into the original columns from that example, it has not undone the SUM aggregation performed on the sales data. For example, instead of two individual sales of 100 and 50 t-shirts in January, we have a single row with the total sales value 150.
| Product | Jan | Feb | Mar |
|---|---|---|---|
| T-Shirt | 150 | 150 | 200 |
| Hoodie | 300 | 430 | |
| Cap | 60 | 90 | 120 |
- Columns To Narrow: Jan, Feb, Mar
- Output Names Column Name: Month
- Output Values Column Name: Total Sales
| Product | Month | Total Sales |
|---|---|---|
| T-Shirt | Jan | 150 |
| T-Shirt | Feb | 150 |
| T-Shirt | Mar | 200 |
| Hoodie | Jan | 300 |
| Hoodie | Feb | |
| Hoodie | Mar | 430 |
| Cap | Jan | 60 |
| Cap | Feb | 90 |
| Cap | Mar | 120 |

