Skip to main content
Creates a measure that ignores the value of a filter in the user query in favor of the filter on the measure itself. This creates measures that maintain their specific filter criteria regardless of what filters the user applies in the query.
This is an advanced filter property that can be added as an argument to any other filter on a measure. It’s commonly used with date_offset_from_query for period-over-period comparisons, but can be used with any filter.

Syntax

measures:
  <measure_name>:
    aggregate_type: <type>
    filters:
      <field>:
        <filter_operator>: <value>
        cancel_query_filter: true

Properties

field
string
required
The field to filter on, specified in the format view_name.field_name. Can be a time, numeric, or string field.
filter_operator
varies
required
Any standard filter operator (e.g., is, not, greater_than, date_offset_from_query, etc.) with its corresponding value.
cancel_query_filter
boolean
required
If true, the measure will ignore a query’s filter value. Instead, the measure will use the filter defined on the measure itself.

Examples

For this example, you’re querying a dataset that has a state: New York filter applied. Using the following compare_to_users_in_california measure in your query would allow you to see the count of users for California without changing the filter in your query. If cancel_query_filter were not applied, you would receive zero results - this is because the measure would filter for users in California within a query filtered for New York.
Ignore filters on state
measures:
  compare_to_users_in_california:
    aggregate_type: count
    filters:
      state:
        is: California
        cancel_query_filter: true

The following example demonstrates how to create a measure that ignores any query filters on two specified fields. Setting the filter to is: "" for both created_at and state tells the measure to ignore any filter on these fields, allowing comparison to all-time totals regardless of any filters applied to the query.
Ignore all filters on created_at and state
measures:
  users_in_all_states_all_time:
    aggregate_type: count
    filters:
      created_at:
        is: ""
        cancel_query_filter: true
      state:
        is: ""
        cancel_query_filter: true

signups_two_years_ago:
  aggregate_type: count
  filters:
    created_at:
      date_offset_from_query: 2 years
      cancel_query_filter: true