> For the complete documentation index, see [llms.txt](https://docs.gaiodataos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gaiodataos.com/tools/tasks/etl/pivot-table.md).

# Pivot Table

<figure><img src="/files/AlQYQ5pADy61jWbTT85u" alt=""><figcaption></figcaption></figure>

The **Pivot Table** task in **Gaio DataOS** allows you to reshape your dataset from a long format (rows) into a wide format (columns), turning categorical values into new columns. It’s ideal for creating cross-tab reports, category comparisons, and dashboard-ready summaries.

{% hint style="warning" %}
**Important:** This task can only be used when a **table is selected** in your flow.
{% endhint %}

***

## How to Use

### **1. Open the Pivot Table Task**

* In the left-side menu, go to:\
  **Tasks > ETL > Pivot Table**

***

### **2. Set Task Name and Output Table**

* **Task label**: (optional) A name for this task within your flow.
* **Result table**: The name of the new table to be created from the pivot transformation.

***

### **3. Select Column to Pivot**

* **Column to pivot**: Choose the column whose unique values will become new column headers (e.g., `product_category`).
* **Sort values**: Choose the sorting order for the new columns: `Ascending` or `Descending`.

***

### **4. Configure Pivot Values**

* A list of unique values from the pivot column will appear.
* You can rename each one under the **Transpose** column to customize the new headers.

***

### **5. Select Value to Aggregate**

* **Value to pivot**: Choose the numeric column you want to summarize (e.g., `sales_amount`, `units_sold`).
* **Aggregation values**: Select the aggregation method:
  * `Sum`
  * `Average`
  * `Count`, etc.

***

### **6. Optional: Add Extra Columns**

* **Extra columns**: Select columns that should be preserved in the output (e.g., `region`, `date`).
* **Position of extra columns**: Choose whether they appear `At start` or `At end` of the resulting table.

***

### **7. Save and Run**

* **Save**: Saves the task for later use in the flow.
* Click **Run** to execute the task in your flow.

***

&#x20;Use Cases

* Compare product categories side by side
* Summarize metrics by region, time, or status
* Create custom pivot views for dashboards
* Transform transactional data into report-ready formats
