Native query variable using a category field filter

I am using native query editor to build a question with some dashboard filters. I have a column named Tags with comma separated field values, i.e:

Tag1,Tag2, Tag3
Tag2, Tag3
Tag1

I want to create a dashboard filter which finds ‘any of’ matches as a drop down selection, i.e the user can select Tag1, or Tag1 AND Tag3 etc

As a workaround I have built a text variable in a WHERE query, where the user can search for the presence of a tag name.

[[and “table”.“Tags” ilike CONCAT(’%’,{{Tags}},’%’)]]

Instead, how can I use the Tags variable mapped to a Category filter, to look up a seperate table Tag_Names which has a row for each Tag name, like:

Tag1
Tag2
Tag3

That way the options would be given in a drop down filter, rather than a text filter.

Many thanks in advance.

Hi @Rlmsh
What you’re asking for is not possible that way.
Currently it’s not possible to have a Field Filter, where you have specified the values manually.
So you would need to have all your tag-values in a separate table, which you could use as a lookup.

There’s an issue open, which is about having the dropdown defined by SQL.
If that gets included, then you could probably do it directly in Metabase - go and vote by clicking the :+1:
https://github.com/metabase/metabase/issues/6820