User Guide Getting Started Help Center Documentation Community Training
New LookML
Old LookML
New LookML
Looker
  
English
日本語
always_filter

Usage

explore: explore_name {
  always_filter: {
    filters: {
      field: field_name
      value: "Looker filter expression"
    }
  }
}

Hierarchy

always_filter

Default Value

None

Accepts

A field name and a Looker filter expression

Definition

always_filter enables you to require users to include a certain set of filters that you define. You also define a default value for the filters. Though users may change your default value for their query, they cannot remove the filter entirely.

The field referenced under the filters parameter can be a dimension or measure. If you need to reference a dimension or measure that is part of a joined view rather than part of this Explore, use view_name.field_name. For example:

explore: order { always_filter: { filters: { field: id value: "123" } filters: { field: customer.id value: "789" } } join: customer { sql_on: ${order.customer_id} = ${customer.id} ;; } }

Here the id filter refers to the id field from order. The customer.id filter refers to the id field from customer. This example also demonstrates that you can require multiple filters.

The default values that you specify accept these types of expressions.

Examples

Force the user to use an Order ID filter (with a default value of “123” that they can change):

explore: order { always_filter: { filters: { field: id value: "123" } } }

Force the user to use an Order ID filter (with a default value of “123” or “234” that they can change):

explore: order { always_filter: { filters: { field: id value: "123, 234" } } }

Force the user to use an Order ID filter (default value of “123”), an Order City filter (default value of “Chicago”), and a Customer Age filter (default value of “18”):

explore: order { always_filter: { filters: { field: id value: "123" } filters: { field: city value: "Chicago" } filters: { field: customer.age value: "18" } } join: customer { sql_on: ${order.customer_id} = ${customer.id} ;; } }

Common Challenges

Users Can’t Remove a Filter Specified by always_filter

The Explore UI does not let users remove a filter that has been added by always_filter. If you want to pre-load filters for an Explore in a way that lets users completely remove the filters, consider creating a query that includes suggested filters and then sharing the query with users so they can use the query and its filters as a starting point.

The always_filter Parameter Overrides a default_value Filter Setting

always_filter overrides the default_value setting for the field. If you declare a value with always_filter, that value will be the default in the Explore. If you do not declare a value with always_filter, then “is any value” is the filter default in the Explore.

Things to Know

If You Want Filters That Users Can’t Change, Consider sql_always_where

If you want an Explore to have filters that are the same for everyone, and cannot be changed in any way, you can use sql_always_where.

If You Want User-Specific Filters That Users Can’t Change, Consider access_filter

If you want an Explore to have filters that are specific to each user, and cannot be changed in any way, you can use access_filter.

Top