Multiple selection in metabase filter

The question is related to metabase I'm creating a new sql question I add a filter to it

SELECT *
FROM testtable (nolock)
[[WHERE category = {{category}}]]

Next, I add this request to the dashboard and want to apply a multiple choice filter to it

But I get the following error: "This field only accepts a single value because it's used in a SQL query."

@Sergey_K With native SQL questions, the Text, Number and Date SQL variable types only accept a single value. The query generated would be something like "category = {{category_var}}" so {{category_var}} can't have more than one value at a time. If you set the dashboard filter to accept a single value it should work.

If you need to allow a multi select you can try one of these options:

  • Recreate this Question with the GUI Query Builder and then use the filters on the Questions
  • If this needs to be a SQL Question then you could replace the text filter with a "Field Filter" instead

I use a Field Filter to a SQL question. When I didnt select anything, the question can run well.

But when I selected in the filter, it gave me an error note.

Could anyone help to debug :pray:

field filters don't work when there are column aliases in SQL questionsn

1 Like

Thanks. Problem solved.