Unpivot is the opposite operation of pivot. This converts multiple columns into rows, transforming data from a wide format to a long format. To do so it creates two new columns: one containing the original column names as values, and another containing the corresponding data values. All other columns that are not unpivoted are kept as is.
Transform categories: Aggregate, Popular
Declared arguments
Columns to unpivot - List of columns to unpivot. List<Column<T>>
Dataset - Dataset to perform unpivot on. Table
Name column - The output column that contains the column names from the original dataset. Literal<String>
Value column - The output column that contains the values from the original dataset. Literal<String>
Type variable bounds:T accepts AnyType
Examples
Example 1: Base case
Argument values:
Columns to unpivot: [new_york_miles, london_miles]
Dataset: ri.foundry.main.dataset.a
Name column: city
Value column: miles
Input:
airline
new_york_miles
london_miles
foundry airways
1000
6000
new air
null
8000
Output:
city
miles
airline
new_york_miles
1000
foundry airways
london_miles
6000
foundry airways
new_york_miles
null
new air
london_miles
8000
new air
Example 2: Base case
Argument values:
Columns to unpivot: [new_york_miles, london_miles]