This is useful if:

  • you want to use a filter box to filter a query where the name of filter box column doesn’t match the one in the select statement
  • you want to have the ability for filter inside the main query for speed purposes
  1. Write your query in SQL Lab with a static placeholder value for the filter. Run the query and click "Explore"

2. Build the visualization as desired and then update the underlying datasource query and replace your placeholder filter value in the WHERE with this Jinja template: {{ "'" + "','".join(filter_values('filter_name')) + "'" }} )


FROM demo_data.car_sales
WHERE car_make in ( {{ "'" + "','".join(filter_values('car_make')) + "'" }} )

This will listen for dashboard filters with the name "car_make" and apply it on query level.

Save the chart and add it to a dashboard.

3. Build a "Filter Box" visualization with your filter_name  as a filter control:

Save this filter box and add it to the dashboard.


The filter parameter will be passed directly into the inner SQL statement. If no filter value is present, no results will be returned.

Did this answer your question?