> 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/tutorials/components/pivot-table/let-users-filter-a-pivot-table.md).

# Let Users Filter a Pivot Table

Add header filters to a Pivot Table so users slice the summary by lead source or stage on the flow screen, with menus that only offer values that exist.

In a pipeline review, a sales manager wants to see only the deals that came from the web, then only those in negotiation, without asking an admin for a new screen. Header filters put a menu per field above the Pivot Table. Each pick reruns the summary on the matching records.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fwujl3ZHiByDaEXH1b0F5%2Fpivot-table-let-users-filter-a-pivot-table-result.png?alt=media" alt="Pivot Table filtered to web deals, with the Stage filter menu open offering three stages"><figcaption><p>With Web picked, the Stage menu offers only the stages web deals reach.</p></figcaption></figure>

## Before you start

* A screen flow with a Pivot Table on **Opportunity**, built as in [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).
* The fields users will filter by. Here, **Lead Source** and **Stage**, two picklists.

## Steps

{% stepper %}
{% step %}

### List the fields users can filter by

Select the Pivot Table on the screen and click **Open Component Builder**. In **Data Mappings**, open **Filters** and select **Lead Source**, then **Stage**.

The query filters of the Data Source decide which records the table can ever show, and users cannot change them. The fields in **Filters** become menus in the header that users set themselves, within those records.
{% endstep %}

{% step %}

### Offer only the values that exist

The **Stage** picklist defines values such as `Prospecting`, `Closed Won` and `Closed Lost`, even when no deal on this screen carries them. Picking one would empty the table.

In the **Filter** group of the **Properties** tab, turn on **Use Record Picklist Values**. The menus now list only the picklist values found in the records.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FXiyKQKszRJdUX0Lbg3k6%2Fpivot-table-let-users-filter-a-pivot-table-filter-group.png?alt=media" alt="Filter group of the property editor with Use Record Picklist Values and Use Cascading Filter Values turned on and Display As Popover off" width="320"><figcaption><p>The Filter group, with both value options on.</p></figcaption></figure>
{% endstep %}

{% step %}

### Narrow each filter by the others

In the same **Filter** group, turn on **Use Cascading Filter Values**. After a user picks a value in one menu, the other menus only offer values that still match.

> **Example:** the manager picks `Web` under **Lead Source**. The **Stage** menu now offers `Qualification`, `Proposal/Price Quote` and `Negotiation/Review`, and drops `Needs Analysis`, since no web deal sits at that stage.

With **Use Cascading Filter Values** on, **Use Record Picklist Values** is ignored: the options already come from the records.
{% endstep %}

{% step %}

### Choose how the filters sit in the header

By default, each field in **Filters** gets its own button in the header. Once a value is picked, the button label shows it after the filter mode, for example **Stage (Equals Negotiation/Review)**.

Turn on **Display As Popover** to gather every filter behind one button that opens a popover instead.

|                                  | One button per filter (default)                      | **Display As Popover** on       |
| -------------------------------- | ---------------------------------------------------- | ------------------------------- |
| What users see                   | One button per field, with the picked value          | One button, all filters inside  |
| Best for                         | One or two filters with short values                 | Several filters, or long values |
| When the header runs out of room | Buttons that no longer fit move behind a funnel icon | Nothing moves                   |

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FEgehTJ5dIw69LsV592G2%2Fpivot-table-let-users-filter-a-pivot-table-popover.png?alt=media" alt="Pivot Table header with one filter button and its popover open, listing Lead Source and Stage" width="480"><figcaption><p>Display As Popover puts every filter behind one button.</p></figcaption></figure>

{% hint style="warning" %}
A long picked value widens its button. When the button no longer fits next to the title, it moves into an overflow menu behind a funnel icon, and the header looks as if the filter vanished. The filter still applies: the **Filtered by** line under the title still names it. Turn on **Display As Popover** when values can be long, such as account names.
{% endhint %}
{% endstep %}

{% step %}

### Save and test

Save the flow and click **Debug**. The header shows **Lead Source** and **Stage** buttons. Open **Stage**: it lists only the four stages the deals carry.

Pick `Web` under **Lead Source**. The table reruns on the web deals only, and the **Stage** menu now offers three stages. Pick `Negotiation/Review`: the table shows only web deals in negotiation, and the line under the title reads **Filtered by Lead Source, Stage**.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>A filter button disappeared after a selection, only a funnel icon is left</summary>

The button label grew with the picked value and no longer fits in the header, so it moved behind the funnel icon. Click the funnel: the filter is inside, with its value. To keep every filter in one place whatever the value length, turn on **Display As Popover**.

</details>

<details>

<summary>The menu offers values that return an empty table</summary>

**Use Record Picklist Values** is off, so a picklist menu lists every value the field defines. Turn it on, or turn on **Use Cascading Filter Values**.

</details>

<details>

<summary>The other menus do not narrow after a pick</summary>

**Use Cascading Filter Values** is off. If it is on, every value of the other field may still exist among the matching records, so there is nothing to remove.

</details>

<details>

<summary>No filter appears in the header</summary>

No field is listed in **Filters**, in **Data Mappings**. The settings of the **Filter** group have no effect until at least one field is there.

</details>

## Related tutorials

* [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): build the Pivot Table this page starts from.
* [Group a Pivot Table by Date](https://docs.avonnicomponents.com/flow/tutorials/components/pivot-table/group-a-pivot-table-by-date.md): summarize the filtered deals by quarter or month.
* [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): put an Export button next to the filters.


---

# 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/tutorials/components/pivot-table/let-users-filter-a-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.
