Can I pass the filter value to the sql parameter of the filter itself?


filter: division_filter {
    type: string
    allowed_value: {value:"West"}
    allowed_value: {value:"East"}
    allowed_value: {value:"Midwest"}
        {% if value == "'West'" %}
          ${state} in ('California', 'Washington')
        {% elsif value == "'East'" %}
          ${state} in ('New York', 'Boston')
        {% elsif value == "'Midwest'" %}
          ${state} in ('Colorado')
        {% endif %}

Would this filter work?

(Izzy) #2

You can’t have a sql: parameter inside of a filter— You make filters affect SQL by using templated filters or parameters: That doc should have some solid examples— Note that you can also reference those values + conditions in a sql_always_where parameter of an explore, if you don’t want to use a derived table.