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 is 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.
The below table cites the Unpivot component's setup properties, include any actions required of the user.
|Name||String||Input the descriptive name for the component.|
|Columns to Narrow||Multiple Select||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.|