I’m building a Looker dashboard where I want certain filters to appear dynamically based on the selection of a hospital. Specifically:
Please let me know if anyone has worked on a similar issue.
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.