Pivot columns
Description
The Pivot Columns activity restructures tabular data by converting unique values in a column into new columns, effectively transposing selected rows into columns. This transformation is useful when converting long-format data into wide-format, making it easier to visualize and analyze grouped or categorized datasets.
It creates a matrix where:
- Each unique value in the Index Column becomes a row
- Each unique value in the Labels Column becomes a new column
- The cell values come from the Values Column
Use this activity to:
- Convert transactional or long-form data into cross-tab reports
- Generate summaries where categories are converted into columns
- Restructure datasets for dashboarding or pivot-based analytics
Use case: A retail company wants to analyze product prices across departments. Using Pivot Columns, they can convert individual product rows into columns under each department, making comparisons easier.
Input
Type | Status | Description |
---|---|---|
Data | Required | A table with at least three columns: one for row identifiers (index), one for labels (column names), and one for values. |
Output
Output Type | Format | Description |
---|---|---|
Data | Table | Transformed table with rows as index values and columns as labels. |
Configuration Fields
Field Name | Description |
---|---|
Index Column | The column whose unique values will be used to create the output rows. A new row is generated for each unique index value. |
Labels Column | The column whose unique values will become column headers in the output. Each distinct value in this column becomes a column in the result. |
Values Column | The column that provides the values to fill in the pivoted table. If multiple entries exist for the same index-label pair, the last one is used. |
If multiple rows have the same combination of index and label, only the last one is retained in the output.
Sample Input
id | category | product | price | in_stock |
---|---|---|---|---|
1 | Electronics | Laptop | 500 | true |
2 | Electronics | Camera | 350 | false |
3 | Electronics | Tablet | 250 | true |
4 | Furniture | Sofa | 600 | true |
5 | Furniture | Bed | 450 | true |
6 | Furniture | Table | 150 | false |
In this example, we want to create one row per
category
, one column perproduct
, and fill the table withprice
values.
Sample Configuration
Field | Value |
---|---|
Index Column | category |
Labels Column | product |
Values Column | price |
Sample Output
category | Laptop | Camera | Tablet | Sofa | Bed | Table |
---|---|---|---|---|---|---|
Electronics | 500 | 350 | 250 | |||
Furniture | 600 | 450 | 150 |