Dashboard Filter for Text Prefix on Custom Question

Hi, I would like to use a dashboard filter for many Questions based on a keyword prefix. This is possible with a Native Query using the LIKE "{keyword}%" operator in SQL. However, I have not found a way to do this using custom questions, and it seems I can only do an exact match for a text field. Does anybody know if it is possible to use a dashboard filter to match prefixes (or regex in general) for Custom Questions?

Hi @yonatan
Yes, but Metabase will quote the variable (to protect against SQL injections).
Depending on your database you would do something like
LIKE concat({{variable}}, '%') or LIKE {{variable}}||'%'
For reference: https://www.metabase.com/learn/sql-questions/sql-variables#basic-input-variable-text

Thanks, @flamber. I fear I may have no been clear enough with my question.
I understand how to use wildcards with filters using native SQL queries, but I'm wondering if it is possible to use them (that is, dashboard filters which a field for partial matches) with Metabase Custom Questions, that is queries built using the notebook editor. Thanks!

@yonatan There's work being done to add different types of advanced filtering on dashboard.
Might be available in 0.42

1 Like