View the original community article here
Last tested: Nov 26, 2020
Faceted (linked) filters in explores aren't possible in Looker. Be sure to give a +1 to the feature request
Situation:
Let's say we two have two filters on an explore page: Country and State. We want the State filter to populate based on the Country filter's selection.
Steps:
- Add a User Attribute for Country.
- Create a derived table for State by using the following syntax:
view: suggestions {
derived_table: {
sql: select distinct state
from your_schema_name.your_table_name
where
country = {{ _user_attributes['country'] | | prepend: "'" | append: "'" }} ;;
}
dimension: state {
type: string
sql: ${TABLE}.state ;;
}
}
- On the explore page, apply the Country filter normally, but make sure to apply the State filter based on the dimension from the derived table, not from the original data table.
- Change User Attribute value to be whatever you select in the Country filter on the explore.
This is a more involved workaround and would not scale well if you have many faceted filters on your explore page. It would also require adding user attributes for each filter field.
This content is subject to limited support.