Possibility to add dynamic filters on models

Hi Team,

is there a way to create a query on top of a model, adding also dynamic filter?

SELECT
   *
FROM {{#1-my-model}} AS my_model
WHERE {{created_at}}

Thanks a lot

After a few hours of attempts, I got it.

There is simply no way to add dynamic filter when querying a model using pure SQL.

Instead, it is possibile to do so while using the query building

Hope this helps!

Roberto can you put here the solution? I don't think this is achievable unless we refactor a lot of how the field filters work on Metabase (which are tied to a table and then compile to the schema.table notation)

1 Like

Hi @Luiggi,

for anyone needing to create dashboards with dynamic filters while using models, the recommendation is:

  • :white_check_mark: Use Query Builder to construct your query
  • :x: Avoid native SQL queries in this specific case

Would it make sense to add a note about this behavior to the Metabase documentation?

Hope this helps clarify the solution for future reference!

so we've been trying to say that since the very beginning, it's all around the docs...