On this Page
Docs Menu

Go to Field Parameter List

This section refers to the filters parameter that is part of a measure

filters can also be used as part of a dashboard, described here

filters can also be used as part of a dashboard element, described here


filters is an optional list of filter expressions that are applied to a measure calculation. It only works with measure types that perform aggregation:

  • type: count
  • type: count_distinct
  • type: sum
  • type: average

The syntax for filters is:

filters: dimension_name: 'Looker filter expression' # You can add more than one filters statement

Refer to Looker’s filter notation for details on how to write valid filter expressions.


In this example, the measure will count distinct IDs that were created in the past 7 days, and were not from disabled users:

- measure: this_week_count type: count_distinct sql: ${TABLE}.id filters: created_date: '7 days' user.status: '-disabled' # 1. List additional filters on additional rows # 2. Minus sign means “not” in this case, # but check notation docs for details # 3. Reference fields from other joined views with # view_name.field_name syntax

As another example, consider data that includes one row per person, who is either a regular employee or a contractor. There is a field, is_contractor, of type yesno that contains yes if the person is a contractor. This measure will count only rows for contractors:

- measure: contractor_count type: count filters: is_contractor: yes

Common Challenges

Don’t Use filters with type: number Measures

Many users try to use filters with type: number measures, which does not work:

# Will NOT work - measure: total_food_profit type: number sql: ${total_revenue} - ${total_cost} filters: segment: 'food'   - measure: total_revenue type: sum sql: ${revenue}   - measure: total_cost type: sum sql: ${cost}  

Instead, apply a filters parameter to any of the individual measures that make up the type: number measure, as follows:

# Will work - measure: total_food_profit type: number sql: ${total_food_revenue} - ${total_food_cost}   - measure: total_food_revenue type: sum sql: ${revenue} filters: segment: 'food'   - measure: total_food_cost type: sum sql: ${cost} filters: segment: 'food'

Still have questions?
Go to Discourse - or - Email Support