Skip to main content
The Unpivot transformation component lets you turn your columns of data into rows. This generally means reducing the number of columns and increasing the number of rows. To configure the Unpivot component, select a number of “Columns to Narrow” that contain data to be flattened into rows. The names of the “Columns to Narrow” will become values in a new column, which you name in the “Output Names Column Name” property, and the values from the “Columns to Narrow” will become values in a new column, which you name in the “Output Values Column Name” property. This component is equivalent to an SQL UNPIVOT function. The Unpivot component is not a direct reversal of the Pivot component, because it cannot undo the aggregation performed in the Pivot component.

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

Name
string
required
A human-readable name for the component.
Columns to Narrow
dual listbox
required
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.
Output Names Column Name
string
required
Assign a name to the generated column that will be populated with the names from the columns in the column list.
Output Values Column Name
string
required
Assign a name to the generated column that will be populated with the values from the columns in the column list.

Examples

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
ProductJanFebMar
T-Shirt150150200
Hoodie300430
Cap6090120
Component configuration:
  • Columns To Narrow: Jan, Feb, Mar
  • Output Names Column Name: Month
  • Output Values Column Name: Total Sales
Output data
ProductMonthTotal Sales
T-ShirtJan150
T-ShirtFeb150
T-ShirtMar200
HoodieJan300
HoodieFeb
HoodieMar430
CapJan60
CapFeb90
CapMar120
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.