# Pivot Table

This guide explains how to create pivot tables in the platform. You can do it in two ways:

1. By choosing the chart type for a visualization to be ‘Pivot Table’ inside the Chart tab of visualization setting.
2. By using the pivot option inside the Aggregate tab of visualization setting.

| **Feature**   | **Method 1: Chart Type**                             | **Method 2: Aggregate Tab**                    |
| ------------- | ---------------------------------------------------- | ---------------------------------------------- |
| **Best For**  | Multi-level/nested rows (e.g., Campaign > Ad Group). | Custom grouping (AI, Patterns, or Word Match). |
| **Row Limit** | Multiple dimensions (nested).                        | Exactly one dimension.                         |
| **Location**  | **Chart** tab → Pivot Table.                         | **Aggregate** tab → Pivot.                     |

### **Create a pivot table by choosing the Pivot Table chart type**

Use this when you want a **multi-level row structure** (e.g. campaigns with ad groups underneath), and when you don’t require custom grouping or extra aggregation as the chart only changes how the same data is displayed; it does not create new aggregated rows.

#### Prerequisite:

* At least **2 dimensions** selected in the **Data** tab (e.g. Campaign + Ad group).

If you select only 1 dimension, the option for Pivot Table as chart type will not appear in the chart tab

#### Steps to Create a Pivot Table

1. Set up your data:

   * Open the visualization settings of a custom datablock.
   * Add at least 2 dimensions (e.g. Campaign, Ad group) and the metrics you need (e.g. clicks, impressions), and fetch the data.

   <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2FvmS25aLQhhox8tJeA52b%2Fimage%20(2).png?alt=media&#x26;token=55e4c3ab-d845-4251-9edf-cfaea6ecbcbc" alt=""><figcaption></figcaption></figure>
2. Switch to Pivot Table:

   * Go to the Chart tab, select Pivot Table as the chart type

   <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2FfMBqRsPm9kC1r8hFSS96%2Fimage%20(3).png?alt=media&#x26;token=7cc7f12b-fe1d-47a4-9ff8-db23b3b3a931" alt=""><figcaption></figcaption></figure>
3. Configure the Pivot Table:

   In the same Chart Tab you’ll see the pivot settings:

   * Pivot Rows:

     * Use the dropdown “Add row dimension” to one or more dimensions as pivot rows to group your data vertically.
     * The first dimension is the top-level group; each extra dimension nests under the previous, each unique value in your dimension creates a new row.

     <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2FhQwBmCiDctF6P8iAxp1M%2Fimage%20(4).png?alt=media&#x26;token=ad974b9f-aadf-43a8-9f81-5f70e2d4d62e" alt=""><figcaption></figcaption></figure>
   * Pivot Column:

     * Chose one dimensions whose unique values become columns (e.g. if “Month” is selected, each month becomes a column).

     * Choose “None” if you only want rows and no column pivot.

     <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2Fcf9NZB8Olym3B0wf4n9v%2Fimage%20(5).png?alt=media&#x26;token=5d71b2f5-fb13-46d7-b466-321772d801aa" alt=""><figcaption></figcaption></figure>
   * Metric Aggregations:

     By default, all metric aggregations are set to SUM, but you can customize this to change how your data is summarized.

     * Click the **"Add Metric Aggregation"** button.
     * **Select the Metric:** Choose the specific field you want to modify from the dropdown.
     * **Choose the Rule:** Select your preferred calculation (Sum, Average, Count, Count Distinct, Weighted Average).
     * **Label (Optional):** Enter a custom name for the column header.

     <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2F26RQiIDIPG7HGrW4KgQh%2Fimage%20(6).png?alt=media&#x26;token=37b4c5d6-b58a-4e61-967d-72883e73c7fa" alt=""><figcaption></figcaption></figure>
4. Optional Display Options:

   Customize your table's layout with these optional totals to make your data easier to scan:

   * **Show row subtotals for outer most row group**  Adds a summary row below each major group, for seeing totals for specific categories (like a single Region or Campaign) at a glance.
   * **Show Grand Total:** Adds a final row at the very bottom of your table that calculates the total metric for your entire dataset.

   <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2FfvDWpafFn3QdqiJlxQ6K%2Fimage.png?alt=media&#x26;token=4df6cd2a-b6a3-4e0e-8c0a-ab45e56e4977" alt=""><figcaption></figcaption></figure>

### **Create a pivot table using the pivot function in aggregation**

Use this when you need exactly one dimension to group your data or when you need **custom grouping** (rules, patterns or word match).

#### Steps to Pivot Data:

1. Ensure you have data:

   * Fetch data from the data tab of the visualization settings so the visualization has rows and columns.

   <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2FQD1XnTjr4wm5aYn893JN%2Fimage%20(7).png?alt=media&#x26;token=15fc5e80-cc9c-4489-9a8d-636232fac121" alt=""><figcaption></figcaption></figure>
2. Set up aggregation:

   * Go to the **Aggregate** tab in the visualization settings and click **Add**.
   * Dimension (Group by):

     * First select a dimension you want to group your data by.
     * You can optionally create rules to transform or map the selected dimension’s values into groups in three ways - Word Match, Pattern or AI.

     <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2FpJJBA9zBxbY2z5yZsOBn%2Fimage%20(8).png?alt=media&#x26;token=52c957bc-aedb-426b-baef-a069e4f6aaaf" alt=""><figcaption></figcaption></figure>
   * Pivot Column:

     * Select a dimension from the dropdown, each of the unique value from the selected dimension will become a column
     * If you set a pivot column, you can set **Footer aggregation for pivot columns** (Sum, Average, Min, Max). This adds a footer row that aggregates across the pivoted columns (e.g. total per row).

     <figure><img src="https://2842104411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpyGcySly0ioPMFyq3FR%2Fuploads%2FfNX7p4fpx5tA94w5SfRq%2Fimage%20(9).png?alt=media&#x26;token=cbc75a81-3e5c-4b2f-bdd1-15d4cb8686e1" alt=""><figcaption></figcaption></figure>
