# Unpivot

## Overview

The Unpivot node allows you to convert columns in your data table into row values. It involves converting wide-format data with multiple columns for different categories or attributes into long-format data, where each category or attribute is represented in a single row.

<figure><img src="https://content.gitbook.com/content/sZmcXPVeWeMtjkE1uRh9/blobs/N3HGvDrmNAoG00zz9SbI/Screenshot%202023-10-03%20at%2014.27.18.png" alt=""><figcaption></figcaption></figure>

## Settings

#### **Convert to rows**

Select the columns that you want to unpivot into rows. All columns' names will be stored in one column and their values in another.

#### **Category column name**

Enter a name for the new column to store the names of the unpivoted columns.

#### **Value column name**

Enter a name for the new column to store the values from the unpivoted columns.

#### **Keep all other columns**

Switch this toggle "on" to keep columns that were not unpivoted.

## **Example**

Consider the following wide-format dataset:

<table><thead><tr><th width="168">Country</th><th>Year</th><th width="165">Product_A_Sales</th><th>Product_B_Sales</th><th>Product_C_Sales</th></tr></thead><tbody><tr><td>USA</td><td>2021</td><td>1000</td><td>2000</td><td>1500</td></tr><tr><td>UK</td><td>2021</td><td>800</td><td>1700</td><td>1200</td></tr><tr><td>France</td><td>2021</td><td>900</td><td>1900</td><td>1300</td></tr></tbody></table>

The result of Unpivot:

| Country | Year | Product    | Sales |
| ------- | ---- | ---------- | ----- |
| USA     | 2021 | Product\_A | 1000  |
| USA     | 2021 | Product\_B | 2000  |
| USA     | 2021 | Product\_C | 1500  |
| UK      | 2021 | Product\_A | 800   |
| UK      | 2021 | Product\_B | 1700  |
| UK      | 2021 | Product\_C | 1200  |
| France  | 2021 | Product\_A | 900   |
| France  | 2021 | Product\_B | 1900  |
| France  | 2021 | Product\_C | 1300  |
