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

# required_fields - Measures

> Specifies fields that must be present whenever the measure is used in a query.

Specifies fields that must be present whenever the measure is used in a query. Useful for measures that should never aggregate across a dimension (e.g. an amount that must be grouped or filtered by currency).

When a measure with `required_fields` is added to a query, the required fields will be automatically added to the query. Required fields must be selected, pivoted, or filtered to a single value with exact equality filter or the query will error. See [Filter requirements](#filter-requirements) for more information.

If any required fields are missing, the query will error.

## Syntax

```yaml theme={null}
<measure_name>:
  required_fields: [<view>.<field>, <view>.<field>, ...]
```

## Properties

<ParamField path="measure_name" type="object[]">
  The name of the measure.

  <Expandable title="measure_name properties" defaultOpen="true">
    <ParamField path="required_fields" type="array">
      An array of individual field references, specified as `<view>.<field>`.

      <Warning>
        Tags and field sets are not supported for this parameter.
      </Warning>
    </ParamField>
  </Expandable>
</ParamField>

## Filter requirements

Only exact single-value equality filters satisfy the required field constraint. The filter must pin the field to one specific value — this is treated as equivalent to grouping by that field.

Only string and numeric equality filters are supported (e.g., `currency = 'USD'` or `level = 5`).

Filters that do **not** satisfy the requirement:

* Multi-value filters (e.g., `currency IN ('USD', 'EUR')`)
* Negated filters (e.g., `currency != 'USD'`)
* Range filters (e.g., `amount > 100`)

<Note>
  Drill queries satisfy required field constraints because drills carry equality filters on the drilled dimensions.
</Note>

## Examples

```yaml title="Foreign exchange amount requiring currency" theme={null}
fx_amount:
  aggregate_type: sum
  required_fields: [transactions.currency]
  sql: ${transactions.amount}
```
