Feature Request: Multi-Select Support for Native SQL Text / Dropdown Filters

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:

  1. Support multi-select

  2. Automatically format selected values appropriately for SQL IN usage

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')


Why This Is Needed

  • Parity with Field Filters, which already support multi-select.

  • Many use cases require:

    • Complex joins

    • CTEs

    • Aggregated subqueries

    • Database-specific SQL features
      where Field Filters are not flexible enough.

  • Improves dashboard usability.

  • Reduces need for SQL hacks or string-splitting logic.

  • Makes Native SQL queries more powerful and consistent.


Suggested Implementation Options

Any of the following would work:

  1. Add a “Allow multiple selections” toggle for Text / Dropdown variables.

  2. Introduce a new variable type like:

    • Multi-Select Text
  3. Provide formatting helpers such as:

    • {{category:list}}

    • {{category:csv}}

    • {{category:quoted_list}}


Example Use Case

SELECT
    cat,
    COUNT(*) AS total
FROM products
WHERE 1=1
[[ AND cat IN {{category}} ]]
GROUP BY cat

Users could:

  • Select none (filter skipped)

  • Select one value

  • Select multiple values

Without modifying SQL structure.


Impact

  • Improves flexibility of Native SQL editor.

  • Reduces reliance on Field Filters.

  • Enhances dashboard interactivity.

  • Aligns with user expectations for modern BI tools.


Thank you for considering this enhancement. It would significantly improve the power and usability of Native SQL in Metabase.