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

# shared_filters - Composite topics

> Applies one filter to a mapped filter-only field or dimension in two or more included topics.

Defines a filter that Omni applies inside the subquery of each mapped topic. Use a shared filter when one user choice, such as a currency or a timeframe, must reach each topic. Each topic maps the shared filter to one of its own fields.

## Syntax

Set `shared_filters` at the top level of a `.composite_topic` file.

```yaml theme={null}
shared_filters:
  <filter_name>:
    label: <string>
    description: <string>
    ai_context: <string>
    display_order: <integer>
    type: <string | number | boolean | timestamp>
    mappings:
      <topic_name>:
        field: <view.field>
```

## Properties

**shared\_filters** `object`

A map of shared filter definitions, keyed by the filter's name. Use the name to reference the filter, for example in [`default_filters`](https://docs.omni.co/modeling/composite-topics/parameters/default-filters).

**shared filter properties**

**label** `string`

The display name for the shared filter in the field browser. If omitted, Omni title-cases the name and turns underscores into spaces. For example, `currency_code` becomes `Currency Code`.

**description** `string`

A description of the shared filter.

**ai\_context** `string`

Context passed to the Omni Agent for this shared filter.

**display\_order** `integer`

Overrides the ordering of the shared filter in the field browser.

**type** `string`

The data type of the shared filter: `string`, `number`, `boolean`, or `timestamp`. If omitted, Omni uses the type of the mapped field for the first topic in the `topics` list that has a mapping, and falls back to `string`.

If the mapped fields have different types and `type` isn't set, the validator shows a warning, and Omni applies one filter value to each field. Set `type` to pick the filter's type and clear the warning.

**mappings** `object` *required*

Maps each topic to the field that the shared filter applies to. You must map at least two topics.

**mappings properties**

**field** `string` *required*

The field within that topic, in the format `view.field`. Map a [filter-only field](https://docs.omni.co/modeling/templated-filters/parameters) or a dimension. Mapping a measure produces a validation warning.

## Examples

### Currency selector across topics

In this example, the `orders` and `campaigns` views each have a `currency` filter-only field:

```yaml title="Filter-only field in each view" theme={null}
filters:
  currency:
    type: string
```

```yaml title="Currency selector shared across topics" theme={null}
topics: [orders_topic, marketing_topic]

shared_filters:
  currency:
    label: "Currency"
    mappings:
      orders_topic:
        field: orders.currency
      marketing_topic:
        field: campaigns.currency
```

When a user sets **Currency** to `EUR` in a workbook, Omni applies `EUR` to `orders.currency` in the orders subquery and to `campaigns.currency` in the marketing subquery.

### Timeframe filter on some topics

In this example, the composite has three topics and the shared filter maps two of them to a date dimension. `type` sets the filter's type explicitly.

```yaml title="Timeframe filter mapped to two of three topics" theme={null}
topics: [orders_topic, marketing_topic, support_topic]

shared_filters:
  activity_window:
    label: "Activity window"
    description: "Limits orders and campaigns to the same date range"
    type: timestamp
    mappings:
      orders_topic:
        field: orders.created_at
      marketing_topic:
        field: campaigns.start_date
```

`support_topic` doesn't have a mapping. A query that filters on **Activity window** and selects fields from `support_topic` will return an error.
