> ## Documentation Index
> Fetch the complete documentation index at: https://honeydew.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Filters

## Introduction to filters

A filter is a type of calculation that can be used as part of filtering expression.

Filters are pushed down automatically by the engine.

## Using Filters

Any boolean attribute or [calculated attribute](/docs/calculations/attributes) can be used as a filter.
In addition, filters can be written as ad-hoc sql expressions.
Filters SQL expressions may combine entities of same granularity or lower -
see [combining entities in calculated attributes](/docs/calculations/attributes#combining-entities).

### Filter Dynamic Datasets

[Dynamic Datasets](/docs/dynamic-datasets) can include filters as part of their components.

Every filter in a dynamic dataset is applied (`AND`).

Filtering is pushed down - every filter is pushed down to apply as early as possible, resulting in higher performance.

<Tip>
  The engine pushes down the filter to the entity where it can be fully computed.

  This has performance implications - for example, a filter like

  ```sql theme={null}
  orders.status = 'O' AND customers.nationkey = 23
  ```

  will be executed on `orders` after joining `customers`.

  In some cases, it is better to separate filters by entity and combine them only in a dynamic dataset or a SQL query.
  If using two attributes as:

  ```sql theme={null}
  orders.status = 'O'
  ```

  And separately

  ```sql theme={null}
  customers.nationkey = 23
  ```

  The latter filter will be pushed down to `customers` before joining it to `orders`, resulting in a better performance.
</Tip>

## Filtering Joins

Data can be filtered as a result of joins when applying filters.

For example, if looking for all customers `customers.custkey` and apply this filter of shipped orders:

```sql theme={null}
orders.status = 'O'
```

Then we will only get customers which have a shipped order, because `orders` filters `customers` after the JOIN between them.

Whether a filter on an entity applies to a different entity depends on the relationship.
See [cross filtering](/docs/modeling/relations#cross-filtering) for more details.

## Order of Computation

Multiple filters may execute in different order. See [filtering order](/docs/advanced-modeling/order-of-computation) for more details.
