How to pass a variable from dashboard to underlying source models?


Please refer to this example Metabase structure:


In this example, table_1 references subquery_for_table_1 and that references model_1. The job of model_1 is to standardize and aggregate data for many reports. The job of subquery_for_table_1 is to tailor the data for the dashboard. Finally, table_1 is responsible for all visualization / formatting aspects to make the report nice and pretty.

In this example, lets say I have a optional clause variable in the SQL query subquery_for_table_1. The widget or what-have-you exists inside the dashboard though. So the variable would need to be supplied to table_1 and be persisted to subquery_for_table_1 where it can be applied to the query.

Is there any way to persist variables through charts this way?

By "variable", I mean subquery_for_table_1 is customized in the following way:

SELECT count(*)
FROM products
WHERE true
  [[AND id = {{id}}]]
  [[AND {{category}}]]