Skip to content

Unpivot

The Unpivot component rotates a table by transforming columns into rows.

UNPIVOT is a relational Snowflake operator that accepts two columns (from a table), along with a list of columns, and generates a row for each column specified in the list. In a query, it's specified in the FROM clause after the table name.

This operator can be used to transform a wide table (e.g. jan_sales, feb_sales, mar_sales) into a narrower table (e.g. month, sales).

Note

The Unpivot component is not a direct reverse of the Pivot component, since UNPIVOT cannot undo aggregations made by PIVOT.


Properties

Name = string

A human-readable name for the component.


Columns to Narrow = dual listbox

Select the columns in the source table to narrow into a single pivot column. The column names will populate name_column, and the column values will populate value_column.


Output Names Column Name = string

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

Assign a name to the generated column that will be populated with the values from the columns in the column list.