Looker Dynamic Filters

I’m building a Looker dashboard where I want certain filters to appear dynamically based on the selection of a hospital. Specifically:

  • If hospital = "New York", then I should see filters for Region and Street.
  • If hospital = "London", then I should see filters for Speciality and Postcode, while hiding Region and Street.

Please let me know if anyone has worked on a similar issue.

0 1 61
1 REPLY 1

The best way I can think of is to have "Placeholder filters"

 

parameter: hospital_selector {
    type: unquoted
    default_value: "New York"
    allowed_value: {
      label: "New York"
      value: "new_york"
    }
    allowed_value: {
      label: "London"
      value: "london"
    }
  }
  
  dimension: filter_1 {
    type: string
    sql: {% if hospital_selector._parameter_value == "new_york" %} ${region}
      {% elsif hospital_selector._parameter_value == "london" %} ${speciality}
      {% else %} ${region}
      {% endif %} ;;
  }

  dimension: filter_2 {
    type: string
    sql: {% if hospital_selector._parameter_value == "new_york" %} ${street}
      {% elsif hospital_selector._parameter_value == "london" %} ${postcode}
      {% else %} ${street}
      {% endif %} ;;
  }

 


As Zach_e mentioned in this post, you'll also need to modify your parameter filter ("hospital_selector") options for "Select filters to update when the filter changes" so that filter_1 and filter_2 reload when you change the parameter value.

Top Labels in this Space
Top Solution Authors