Connect Metabase dashboard filters to a SQL question with Field Filters
To connect a Metabase SQL question to a dashboard filter, add a Field Filter variable to the SQL and map it to a database field. Write `WHERE {{created_at_filter}}`—do not prefix it with `created_at =`. Metabase builds the condition for date ranges or multiple selections. This guide follows the latest official docs checked on 2026-11-18.
Connect Metabase dashboard filters to a SQL question with Field Filters
To connect a Metabase SQL question to a dashboard filter, add a Field Filter variable to the SQL and map it to a database field. Write WHERE {{created_at_filter}}—do not prefix it with created_at =. Metabase builds the condition for date ranges or multiple selections. This guide follows the latest official docs checked on 2026-11-18.
Concepts
A Field Filter maps a variable to a database field and creates a smart widget. A basic variable inserts a simple value, for example WHERE category = {{category}}. Prefer a Field Filter when filtering a real database column; use a basic variable for a value that cannot map to a database field, such as a custom expression. Basic variables have more limited dashboard-filter behavior.
Add a Field Filter to SQL
Assume an orders table with id, created_at, and category columns. The names are illustrative. In Metabase, choose + New > SQL query (or Native query) and write: SELECT id, created_at, category FROM orders WHERE {{created_at_filter}}. The variable must appear in a WHERE clause without a column name or comparison operator.
Map it to a dashboard
In the variable panel, set Variable type to Field Filter, then map it to the actual orders.created_at database field. Choose the widget type and label. Run or preview the question and save it. Add the saved question to a dashboard. Edit the dashboard, add a date filter, connect it from the question card’s mapping menu to created_at_filter, then finish editing and save. Select a date range and verify the SQL card changes; clear the filter to check the unfiltered range.
Aliases and joins
If the query refers to an aliased table, configure Table and field alias to match the SQL name, such as o.created_at for orders AS o. If the filtered field is in another table, include the necessary join in the main query and map the variable to that database field. A field filter cannot target a database field that the query does not include.
Troubleshooting and limits
If SQL errors, remove any extra field = before the Field Filter and confirm the WHERE {{variable}} syntax. If the dashboard widget does nothing, check its card mapping, the variable type, and the database-field mapping. If a dropdown is empty or odd, check the field’s Metabase metadata and widget type. A basic variable may not support the dashboard widget’s date range or multiple-value behavior; use a Field Filter where the query maps to a real field. An unset optional variable may cause the WHERE condition to be omitted, so confirm that the unfiltered query is appropriate.
The SQL schema is illustrative and was not run against a Metabase instance. UI labels can vary by version and localization.
Sources
[Metabase documentation: Field filters](https://www.metabase.com/docs/latest/questions/native-editor/field-filters)
[Metabase documentation: Dashboard filters](https://www.metabase.com/docs/latest/dashboards/filters)
[Metabase documentation: Basic SQL parameters](https://www.metabase.com/docs/latest/questions/native-editor/basic-sql-parameters)
[Metabase Learn: connect dashboard filters to SQL questions](https://www.metabase.com/learn/metabase-basics/querying-and-dashboards/sql-in-metabase/filters)