> For the complete documentation index, see [llms.txt](https://docs.phocassoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.phocassoftware.com/flex-modes/explore-your-data/filter-data/create-advanced-filters.md).

# Create advanced filters

Create advanced filters when you need more control than a simple focus or search provides.

{% hint style="info" %}
User permission: **Query** > **Search**
{% endhint %}

Advanced filters use rules to define which data displays in the grid. Use them when you need more control than a simple focus, exclude, or keyword search provides.

You can combine multiple rules and control whether the data needs to meet all or only some of the criteria. For example, you might use an advanced filter to answer questions such as:

* *Which customers had sales values that declined by more than 5% over the last 3 months?*
* *Which sales reps earned less than $100,000 in sales revenue in the financial year to date?*

{% embed url="<https://phocassoftware.wistia.com/medias/s33m129y6s>" %}
Create an advanced filter
{% endembed %}

You can save the filtered view as a favorite so you don't need to recreate the rules each time.

## Understand the filter types

Each rule displays as a card in the Advanced filter panel and uses one of these filter types:

| <p><strong>Condition</strong></p><p>Create a comparison using data in the grid or a value you enter. This is similar to filtering from the grid, but gives you more flexibility when defining the comparison.</p> | <img src="https://content.gitbook.com/content/aDGOWDU4SqRSiSPGXHgW/blobs/OsJxYQTK4xm52AhsZYyl/Screenshot%202026-03-18%20at%2013.30.16.png" alt="" data-size="original"> |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>Focus (or exclude)</strong></p><p>Focus on or exclude specific data. This gives the same result as focusing on or excluding data in the grid.</p>                                                      | <img src="https://content.gitbook.com/content/aDGOWDU4SqRSiSPGXHgW/blobs/RARGNC0tSuXcUL8cgXTH/image.png" alt="" data-size="original">                                   |
| <p><strong>Keyword</strong></p><p>Search for matching property values. This gives the same result as a keyword search in the grid.</p>                                                                            | <img src="https://content.gitbook.com/content/aDGOWDU4SqRSiSPGXHgW/blobs/9eBZwAhmnH6T2fiqNoWT/image.png" alt="" data-size="original">                                   |

## Open the Advanced filter panel

Click **Advanced filter** in the toolbar to open the panel.

If you've already filtered the grid using another method, such as Focus, Exclude, a keyword search, or a filter from the grid, the corresponding rule cards display in the panel.

<figure><img src="https://content.gitbook.com/content/aDGOWDU4SqRSiSPGXHgW/blobs/YXfrc5U3s4NbEa0L2e7t/Screenshot%202026-03-18%20at%2013.38.43.png" alt=""><figcaption></figcaption></figure>

If no filters are applied, a blank rule card displays so you can start creating a filter.

<figure><img src="https://content.gitbook.com/content/aDGOWDU4SqRSiSPGXHgW/blobs/ioNbvp3jqXeqvnaZreQ6/Screenshot%202026-03-18%20at%2013.35.09.png" alt=""><figcaption></figcaption></figure>

## Add a rule

Click **Add filter** to add rule card.

New rules use **Condition** by default. To change the type of filter, select the colored filter-type label on the rule card. For example, you can change a new **Condition** rule to **Focus** or **Keyword**.

<div align="left"><figure><img src="https://content.gitbook.com/content/aDGOWDU4SqRSiSPGXHgW/blobs/l2wRo5I0hlS1EY1YgMoi/image.png" alt="" width="114"><figcaption></figcaption></figure></div>

Each filter type has its own settings. Make the applicable selections or enter the required values, then select **Apply** to update the grid.

## Combine filter rules

Add multiple rules when you need to filter data using more than one condition.

By default, multiple rules use **AND** logic, which means the data must meet all the rules. Change this to **OR** when the data only needs to meet one of the rules.

For example, you might want to show data where:

* Customer type is Healthcare or IT **and** a high margin was achieved
* **or** the sale occurred in a new territory

{% hint style="success" %}
Watch the [Create an advanced filter video](#create-an-advanced-filter) to see the impact of switching from an And to an Or condition.
{% endhint %}

### Change the order of filter rules

Advanced filter rules are applied from top to bottom, with each rule filtering the results of the one above it.

The order of rules matters when they use different dimensions. Changing the order can produce different results. When the rules use the same dimension, changing their order doesn't affect the results.

To change the order, drag the rules up or down the list, then select **Apply**.

#### Example 1: Rules using different dimensions

Suppose you want to find products with sales greater than 100,000 in the UK.

These filters use two dimensions, Product and Country. Changing the order of the rules affects which sales are checked against the condition.

**Condition first, then Focus**

The Condition rule finds products with sales greater than 100,000 across all countries.&#x20;

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2F1pqoAnEv8tBrOdxgptyr%2Fimage.png?alt=media&amp;token=18908664-6a68-4866-930d-3e19ea20d08c" alt=""><figcaption></figcaption></figure>

The Focus rule then restricts the results to the UK. The three products remain in the results because they qualified based on their sales across all countries, even though their individual UK sales are below 100,000. Their combined UK sales are 134,873.76.

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2F5HHXVmRsC3toV1aGc5tb%2Fimage.png?alt=media&amp;token=592dc84e-9aff-43e3-a65c-92c115b8be3f" alt=""><figcaption></figcaption></figure>

**Focus first, then Condition**

The Focus rule first restricts the data to the UK.&#x20;

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2Frnmr0RekTGkUy9Nu1rVN%2Fimage.png?alt=media&amp;token=30fea3fb-7db1-47fd-9652-7ec262fcba19" alt=""><figcaption></figcaption></figure>

The Condition rule then checks which of those products have sales greater than 100,000. No products qualify because none has UK sales greater than 100,000.

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2FhKW4onVJyXrlSMWecihr%2Fimage.png?alt=media&amp;token=20018b4e-e57f-4a2d-a0f3-af0da7853aca" alt=""><figcaption></figcaption></figure>

**Why the results differ**

Both rules are applied, but their order determines which data is used to evaluate the condition. Applying Focus first restricts the data before the condition is checked.

#### Example 2: Rules using the same dimension

These filters use two rules on the Product dimension: one to focus on three selected products and another to find products with a non-zero sales value.

<figure><img src="https://2122657374-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaDGOWDU4SqRSiSPGXHgW%2Fuploads%2FojoGZouX2QIe1Jg9BIYC%2Fimage.png?alt=media&amp;token=8ce15a5f-14ad-4576-a171-6c3d5cefa9da" alt=""><figcaption></figcaption></figure>

Both rule orders return the same three products because the rules use the same dimension. In this case, changing the order doesn't affect the results.

### Group rules

Use groups when you need to combine AND and OR logic in a more complex filter.

Select **Add group** to create a group card, then drag the applicable rule cards into the group. You can add multiple groups and nest one group inside another.

For example, you might group several customer-type rules using OR, then combine that group with a margin rule using AND.

{% hint style="success" %}
Watch the [Create an advanced filter video](#create-an-advanced-filter) for an example of adding a group.
{% endhint %}

## Edit or remove filter rules

Click the **Advanced filter** button to open the panel and view the existing rules.

* **Edit a rule**: Change the settings as required.
* **Delete a rule or group**: Click the **X** button at the top right of its card.
* **Delete all rules**: Click **Clear all rules**.

Click **Apply** to save your changes.

To remove an applied filter from the filter bar without resetting the rest of your analysis, see [Remove filters](/flex-modes/explore-your-data/filter-data.md#remove-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.phocassoftware.com/flex-modes/explore-your-data/filter-data/create-advanced-filters.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.
