> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/flow-components/pivot-table.md). Agents can also search and read this documentation through its [MCP server](https://docs.avonnicomponents.com/~gitbook/mcp).

# Pivot Table

The Pivot Table summarizes records into grouped rows and columns on a flow screen, with totals, subtotals and cells that open the records behind each number.

## Overview

The **Pivot Table** turns a set of records into a summary grid on a flow screen. A sales manager sees open pipeline by region down the side and by stage across the top, with a total for each, and clicks any number to see the deals behind it. The component runs its own aggregate query, so the flow needs no Get Records and no Loop to build the numbers.

Use the Pivot Table when a list of records is too long to read and the question is "how much, per what". You choose the fields that group the records, the value to aggregate, which totals appear, and whether users can open a cell, filter the table or export it.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fz9DlKl4UvK71Alt20UWH%2Fpivot-table-grid.png?alt=media" alt="A Pivot Table on a flow screen, with opportunities grouped by business and stage down the side, by closing month across the top, and a sum of pipeline in each cell"><figcaption><p>Rows grouped by business and stage, columns grouped by closing month, and a sum in each cell, with a <strong>Subtotal</strong> per group and a grand <strong>Total</strong>.</p></figcaption></figure>

### Build your first Pivot Table

New to the component? [Show a Pipeline Summary and Drill Into Any Cell](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/show-a-pipeline-summary-and-drill-into-any-cell.md) walks through the whole build: the screen, the query, the groupings, the aggregation and the detail rows. This page is the reference for every setting.

***

## Tutorials

Step-by-step builds on the same opportunity data, gathered on the [Pivot Table tutorials](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table.md) page.

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Show a Pipeline Summary and Drill Into Any Cell</strong></td><td>Open pipeline by region and stage, and the deals behind any number a manager clicks.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FGvct9XYpJLTYCipotdK3%2Fpivot-table-cover-show-a-pipeline-summary-and-drill-into-any-cell.png?alt=media">pivot-table-cover-show-a-pipeline-summary-and-drill-into-any-cell.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/show-a-pipeline-summary-and-drill-into-any-cell.md">Show a Pipeline Summary and Drill Into Any Cell</a></td></tr><tr><td><strong>Show Totals, Subtotals and Stacked Summaries</strong></td><td>A grand total, subtotals per region, and deal value with deal count in one cell.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FvEUbCJBkZY30rqJ3bnjV%2Fpivot-table-cover-show-totals-subtotals-and-stacked-summaries.png?alt=media">pivot-table-cover-show-totals-subtotals-and-stacked-summaries.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/show-totals-subtotals-and-stacked-summaries.md">Show Totals, Subtotals and Stacked Summaries</a></td></tr><tr><td><strong>Group a Pivot Table by Date</strong></td><td>Closed won revenue per year, quarter or month, with readable month names.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fh9p4Am3ms0mqtZeCwRln%2Fpivot-table-cover-group-a-pivot-table-by-date.png?alt=media">pivot-table-cover-group-a-pivot-table-by-date.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/group-a-pivot-table-by-date.md">Group a Pivot Table by Date</a></td></tr><tr><td><strong>Let Users Filter a Pivot Table</strong></td><td>Header filters that slice the summary by lead source or stage on the flow screen.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FXgDSLsPAYz8bq2xmdKB9%2Fpivot-table-cover-let-users-filter-a-pivot-table.png?alt=media">pivot-table-cover-let-users-filter-a-pivot-table.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/let-users-filter-a-pivot-table.md">Let Users Filter a Pivot Table</a></td></tr><tr><td><strong>Export a Pivot Table and Add Header Actions</strong></td><td>Export and Refresh buttons in the header: download Excel or CSV, reload the numbers.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FwXJaCEoXE6JQLjTxB6OA%2Fpivot-table-cover-export-a-pivot-table-and-add-header-actions.png?alt=media">pivot-table-cover-export-a-pivot-table-and-add-header-actions.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/export-a-pivot-table-and-add-header-actions.md">Export a Pivot Table and Add Header Actions</a></td></tr></tbody></table>

***

## Projects

See this component in a complete Salesforce workflow. This project uses Avonni Dynamic Components and includes AI-assisted and manual build steps.

## Data Source

The Pivot Table always uses a **Query** data source. There is no **Manual** or **Variable** option: a record collection already stored in a flow variable cannot be pivoted. The query editor also hides **Limit** and **Order By**, because the component groups and sorts the results itself.

* **Object API Name**: the object to summarize, for example `Opportunity`.
* **Filters**: the conditions that narrow which records are counted, for example **Closed** Equals `false` for open pipeline.

The query's advanced options apply here too. See [Query](https://docs.avonnicomponents.com/flow/component-builder/data-sources/query.md) for the details.

| Setting                       | What it does                                                                                                                                                                                                                 |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **System Mode**               | Runs the query in system mode, so the totals include records the running user cannot see. Use it only when every viewer is allowed to see those totals.                                                                      |
| **Strip Inaccessible Fields** | Removes the fields the running user cannot access from the query results.                                                                                                                                                    |
| **Query Refresh Emp**         | Re-runs the query when a platform event is received, so the numbers update without reloading the screen. Set the event in **Channel Name**; **Key Field Name** and **Key Field Value** limit the refresh to matching events. |

{% hint style="warning" %}
If **Detail Rows** is on, build the query filter conditions in the query editor. When the whole filter is set from a flow text variable, the cells are filtered correctly but the records listed under a clicked cell are not: they can include records the filter should exclude. Until this is fixed, turn **Detail Rows** off on a table filtered that way.
{% endhint %}

### Data Mappings

The Data Mappings section gives the grid its shape.

* **Group Rows**: the fields whose values are listed down the side of the table.
* **Group Columns**: the fields whose values are spread across the top of the table.
* **Aggregations**: the fields computed in the body of the table. Each one takes a **Field** and an **Aggregation**: **Sum** (the default), **Average**, **Count**, **Count Distinct**, **Maximum** or **Minimum**.

Each grouping or aggregation can turn on **Custom Label** and show a **Label** of your own instead of the field label, such as `Pipeline` for a Sum of Amount.

A grouping on a date or date/time field has two more settings:

* **Date Grouping**: the period the dates are grouped by: **Year**, **Quarter**, **Month**, **Week**, **Day**, **Year-Quarter**, **Year-Month** or **Year-Week**. A combined period such as **Year-Month** adds one header level per part (the year, then the month).
* **Display Full Label**: shows month names (`January`) instead of month numbers (`1`). It changes the month part only, and the names are always in English.

[Group a Pivot Table by Date](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/group-a-pivot-table-by-date.md) shows both on closing dates.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FjciUimxi20n7to9OLizA%2Fpivot-table-builder-data-mappings.png?alt=media" alt="The Data Mappings section of the property editor, with two Group Rows, one Group Column and one Sum aggregation" width="320"><figcaption><p><strong>Data Mappings</strong>: two fields grouped down the side, one across the top, and <strong>Amount</strong> aggregated as a <strong>Sum</strong>.</p></figcaption></figure>

**Filters**, in the same section, is a different setting from the query **Filters** above. It lists the fields users can filter the table by, from the header filter menu. The **Filter** group under Configuration only has an effect once at least one field is listed here.

## Configuration

Select the component on the screen and click **Open Component Builder**. The panel has three tabs: **Properties**, **Interactions** and **Style**. The sections below follow the Properties tab.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FTO5JSmJA4TKKeqoClb5s%2Ftips-editor-tabs.png?alt=media" alt="The Properties tab of the property editor showing the Show Grand Total, Show Subtotals and Stacked Summaries toggles above the Detail Rows group" width="320"><figcaption><p>The top of the <strong>Properties</strong> tab: the summary toggles, then the <strong>Detail Rows</strong> group.</p></figcaption></figure>

### Summaries

| Setting               | What it does                                                                                                                                                                                                            |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Show Grand Total**  | Adds a **Total** row at the bottom and a **Total** column on the right.                                                                                                                                                 |
| **Show Subtotals**    | Adds a **Subtotal** for each group. Row subtotals need at least two **Group Rows**, column subtotals at least two **Group Columns**. With one field on an axis, that axis shows no subtotal even when the toggle is on. |
| **Stacked Summaries** | With two or more aggregations, shows their values stacked in one cell instead of side by side in separate columns.                                                                                                      |

[Show Totals, Subtotals and Stacked Summaries](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/show-totals-subtotals-and-stacked-summaries.md) builds all three.

### Detail Rows

| Setting                 | What it does                                                                                                                                                 |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Detail Rows**         | When a user clicks a number, a panel opens under the grid and lists the records behind it.                                                                   |
| **Enable Inline Edit**  | Lets users edit the values in that panel. Requires **Detail Rows**.                                                                                          |
| **Detail Rows Actions** | Adds row actions in the panel. Each action has a **Label**, a **Name**, an **Icon Name**, and **Disabled** and **Hidden** options. Requires **Detail Rows**. |

The panel lists the record name and one column per aggregated field. It states the grouping the number came from, so the user knows which cell they opened.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fa8oup39iiIoGnFnJH6ip%2Fpivot-table-detail-rows.png?alt=media" alt="A Pivot Table with one aggregation cell selected and a detail panel open below it, listing the two records behind that number"><figcaption><p>A cell clicked open. The detail panel lists the records behind the number and states the grouping it came from.</p></figcaption></figure>

### Filter

These settings control the header filter menu. They apply to the fields listed in **Filters**, in the Data Mappings section.

| Setting                         | What it does                                                                                                                                             |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Display As Popover**          | Gathers all the filters behind one button that opens a popover, instead of one button per field.                                                         |
| **Use Record Picklist Values**  | Offers only the picklist values found in the records, instead of every value defined on the field.                                                       |
| **Use Cascading Filter Values** | When a user picks a value in one filter, the other filters only offer values that still match. When it is on, **Use Record Picklist Values** is ignored. |

Each filter menu also has a filter mode button that sets how the value is matched. Nothing is configured in the builder: the modes follow the field type, and users pick one as they filter.

* **List, text and picklist filters**: **Equals** (default), **Not Equals**, **Empty**, **Not Empty**.
* **Number, date and time range filters**: **Between** (default), **Not Between**, **Equals**, **Not Equals**, **Less Than**, **Less or Equal**, **Greater Than**, **Greater or Equal**, **Empty**, **Not Empty**.
* **Checkbox filters**: no mode button; they always match on **Equals**.

**Empty** and **Not Empty** test the field itself, so the menu hides its value inputs when either is selected. [Let Users Filter a Pivot Table](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/let-users-filter-a-pivot-table.md) sets up filters end to end.

### Header

| Setting                                  | What it does                                                                                                                                                           |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Title** and **Caption**                | Label the table. The caption is displayed above the title.                                                                                                             |
| **Avatar**                               | Shows an avatar in the header, from a **Fallback Icon Name**, an **Image** or **Initials**, with a **Size** and a **Variant** (**Circle** or **Square**).              |
| **Is Joined**                            | Squares the bottom border and removes the shadow, so the header sits flush on the component below it.                                                                  |
| **Actions**                              | The header buttons. Each one has a **Label**, a **Name**, an **Icon Name**, a **Title** shown on hover, **Alternative Text**, and **Disabled** and **Hidden** options. |
| **Visible Actions Buttons**              | How many actions show as buttons before the rest move into a menu.                                                                                                     |
| **Hide Actions** and **Disable Actions** | Hide or disable the header actions.                                                                                                                                    |

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FThHMachJiiJV2lu5fYBM%2Ftips-header-two-names.png?alt=media" alt="The Header group of the property editor, showing Title, Caption, Avatar, Is Joined, Actions, Visible Actions Buttons, Hide Actions and Disable Actions" width="320"><figcaption><p>The <strong>Header</strong> group, from <strong>Title</strong> down to <strong>Disable Actions</strong>.</p></figcaption></figure>

### No Results Message

At the bottom of the Data Mappings section.

* **No Results Message** replaces the default text shown when the query returns no records.
* **Hide No Results Image** and **Hide No Results Message** remove the empty-state image and the text.

## Interactions

The Interactions tab has two triggers: **Header Action Click** and **Detail Rows Action Click**. Each interaction is tied to one action through its **Target Name**, which is the **Name** you gave the action in **Actions** or **Detail Rows Actions**. Create the action first, then bind it here.

Two interaction types matter most on this component:

* [**Refresh Query**](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/refresh-query.md) re-runs the aggregate query, for example from a Refresh button in the header.
* [**Export To**](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/export-to.md) downloads the table as an Excel or CSV file. Its **Default Export View** is specific to the Pivot Table: **Formatted Report** exports the grid as it appears, with its formatting, **Details Only** exports the same grid with raw, unformatted values. **Default File Name**, **Available File Formats**, **Default Encoding Type** and **Hide Export Dialog** complete it.

The standard flow interactions are available as well, such as [**Open Flow Dialog**](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/open-flow-dialog.md) and [**Show Toast**](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/show-toast.md). An **Open Flow Dialog** can run **Refresh Query** when the dialog finishes, so the numbers reflect what the dialog changed. [Export a Pivot Table and Add Header Actions](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/export-a-pivot-table-and-add-header-actions.md) wires an export and a Refresh button.

## Styling

The Style tab has **Margin**, **Padding**, **Size** (width and height), **Border** and **Header**. Two more groups, **Flow Dialog Header** and **Flow Dialog Footer**, appear only when the component has an **Open Flow Dialog** interaction, and they style that dialog.

## Output Variables

| Output variable                     | Type    | What it returns                                                                                                                                                                                                  |
| ----------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Clicked Header Action Name**      | Text    | The **Name** of the header action the user clicked.                                                                                                                                                              |
| **Clicked Detail Rows Action Name** | Text    | The **Name** of the detail rows action the user clicked.                                                                                                                                                         |
| **Number of Items**                 | Integer | Not populated in a flow today: it always returns `0`. Do not branch a flow on it. To test whether there is anything to summarize, run a Get Records with the same filter before the screen and check its result. |

The settings themselves (**Title**, **Show Grand Total**, **Filters** and the others) can also be read from the component after the screen, but they return what you configured, not what the user did.

### Flow Interaction Output Variables

**Clicked Header Action Name** and **Clicked Detail Rows Action Name** are short-lived. Each is set when its action is clicked, can be read by the interaction that runs in response, and is cleared once that interaction ends. Read them inside the interaction, not later in the flow. See [Flow Interaction Output Variables](https://docs.avonnicomponents.com/flow/component-builder/interactions-panel/flow-interaction-output-variables.md).

## Troubleshooting

<details>

<summary>The table is empty</summary>

Check that **Object API Name** is set, and that at least one **Group Rows** or **Group Columns** field and one **Aggregations** field are mapped. Then check the query **Filters**: if no record matches, the table shows the **No Results Message**.

</details>

<details>

<summary>Show Subtotals is on but no subtotal appears</summary>

Subtotals need at least two fields on the same axis. With one **Group Rows** field and one **Group Columns** field, the table has nothing to subtotal. Add a second grouping, for example Region then Stage down the side.

</details>

<details>

<summary>A clicked cell lists records that should be filtered out</summary>

This happens when the query filter is set from a flow text variable and **Detail Rows** is on. The cells are right; the records listed under them ignore that filter. Build the filter conditions in the query editor instead, or turn **Detail Rows** off for that table until the issue is fixed.

</details>

<details>

<summary>A Decision after the screen never sees any rows</summary>

**Number of Items** is not populated in a flow and always returns `0`. Run a Get Records with the same filter before the screen and test its result instead.

</details>

<details>

<summary>Detail rows can't be edited</summary>

Turn on both **Detail Rows** and **Enable Inline Edit**, and check that the running user can edit the aggregated fields. The panel shows the record name and the aggregated fields only, so the aggregated fields are the only ones a user can edit there.

</details>

<details>

<summary>The filter menu is empty, or a filter button disappeared</summary>

The menu only shows fields listed in **Filters**, in the Data Mappings section. If a filter button vanishes after a long value is selected, it has moved into the overflow menu behind the funnel icon: the filter is still applied. See [Let Users Filter a Pivot Table](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/let-users-filter-a-pivot-table.md).

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/flow-components/pivot-table.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
