> 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).

# Pivot Table

The **Pivot Table** summarizes records into a cross-tabulated grid — grouped rows and columns with aggregated values — directly on a Flow screen. It runs its own aggregate query and can show grand totals, subtotals, and expandable detail rows.

## Overview

Use the Pivot Table to turn a set of records into a summary matrix: choose how the data is grouped and aggregated in the query, then control which totals appear, whether users can drill into detail rows, and how the table can be filtered.

## Data Source

The Pivot Table builds its grid from a **Query** data source — it runs its own aggregate (CUBE) query over the selected object and fields. Configure the object, grouping, and measures in the query editor.

## Configuration

### Summaries

* **Show Grand Total** displays an overall total across all rows and columns.
* **Show Subtotals** displays subtotals for each group.
* **Stacked Summaries** stacks the summary values rather than laying them out side by side.

### Detail Rows

* **Detail Rows** lets users expand a summary to see the underlying records.
* **Enable Inline Edit** allows editing values directly in the detail rows. Requires **Detail Rows**.
* **Detail Rows Actions** defines row-level actions; each action has a **Label**, **Name**, **Icon Name**, and **Disabled** / **Hidden** flags.

### Filter

* **Display As Popover** shows the filter controls in a popover instead of inline.
* **Use Record Picklist Values** populates filter options from the record's picklist values.
* **Use Cascading Filter Values** narrows dependent filter options based on earlier selections.

### Header

* **Title** and **Caption** label the table.
* **Header Avatar** shows an avatar in the header, and **Is Joined** visually joins the avatar to the title.
* **Hide Header Actions** / **Disable Header Actions** control the header action menu, and **Visible Header Actions Buttons** sets how many actions show as buttons before overflowing into a menu.

## Interactions

Header and detail-row actions raise interactions the Flow can react to (for example, a detail-row action click). Configure the actions in the panels above and bind them in the Interactions panel.

The [**Export To**](/flow/component-builder/interactions-panel/export-to.md) interaction is also available on the Pivot Table — add it as a header or detail-row action to let users download the table's data as an Excel or CSV file.

## Styling

The Style tab exposes **Margin**, **Padding**, **Size** (width/height), **Border**, **Header**, and **Flow Dialog** (appearance when shown inside a Flow dialog).

## Output Variables

| Output variable                                                   | Type                                | What it returns                                                        |
| ----------------------------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------------- |
| **Number of Items**                                               | Integer                             | The number of records summarized by the table.                         |
| **Title** / **Caption**                                           | Text                                | The current header title and caption.                                  |
| **Show Grand Total** / **Show Subtotals** / **Stacked Summaries** | Boolean                             | The current summary display settings.                                  |
| **Filters**                                                       | Text Collection                     | The active filter values.                                              |
| **Detail Rows Actions**                                           | Apex-defined (`DetailRowsAction[]`) | The configured detail-row actions (also available serialized as text). |

### Flow Interaction Output Variables

This component exposes Flow Interaction Output Variables — values surfaced to the interaction that fires (for example on a row or header action), so a Flow interaction can read the relevant row/action context as it happens.

## Troubleshooting

* **No rows appear** — verify the Query data source returns records and that the grouping fields are set.
* **Detail rows can't be edited** — enable both **Detail Rows** and **Enable Inline Edit**, and confirm the underlying fields are editable.
* **Totals look wrong** — check whether **Show Subtotals** / **Show Grand Total** match the grouping in the query.


---

# 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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
