# 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="/files/JkhUMFM4S480rCLIlmGW" 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  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tabula.io/data-flows/tools-nodes/table-operations/unpivot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
