Summary
Enable multi-select capability for Native SQL text filters (custom dropdown variables) similar to Field Filters, allowing users to select multiple values and use them in IN clauses.
Problem Statement
Currently, when using a Text filter with custom dropdown values in a Native SQL query, Metabase replaces the variable with a single selected value.
For example:
SELECT *
FROM products
WHERE cat = {{category}}
If the user selects cat_a, Metabase replaces it as:
WHERE cat = 'cat_a'
However, there is no native support for selecting multiple values (e.g., cat_a, cat_b) and having Metabase automatically format it for use in an IN clause.
This forces users to:
-
Use Field Filters (which may not always be suitable)
-
Or manually implement workarounds (e.g., comma-separated parsing in SQL)
-
Or duplicate dashboards for different filtering needs
Expected Behavior
Allow Text / Custom Dropdown filters in Native SQL to:
-
Support multi-select
-
Automatically format selected values appropriately for SQL
INusage
Example:
If a user selects:
cat_a
cat_b
Then:
WHERE cat IN {{category}}
Should be rendered as:
WHERE cat IN ('cat_a', 'cat_b')
Example Use Case
SELECT
cat,
COUNT(*) AS total
FROM products
WHERE 1=1
[[ AND cat IN {{category}} ]]
GROUP BY cat
drop_down_option
filter_dropdown_list

