What is a filter?
A filter is a predicate expression that limits the results of a query based on some stated criteria.
For example, you may want to limit the records in your
Orders table so that you only see orders where the value of the
Total field is over 100. We can use a predicate expression,
Total > 100, to filter the orders. For each record, the query evaluates whether that expression resolves true or false, and narrows the results accordingly. So in this case if the record has a total greater the 100, that record is included in the results.
In SQL, queries are filtered using the
WHERE clause, like
WHERE Total > 100. You can also filter aggregations in SQL using the
HAVING clause, like
HAVING AVG(rating) > 3.5.
Filters in Metabase
- Filter the results of your questions.
- Add filters to your dashboards.
- Set up cross-filtering so dashboard filters update when someone clicks on a card.
- Link filters on a dashboard to limit results based on the value of another filter.
- Configure smart field filters in native SQL queries that know which filtering options to present based on field type and column data.
- Create filter widgets that act as a search function on a dashboard, like for a lookup tool.
Example filter in Metabase
Figure 1 shows the
Products table in Metabase’s Sample Database, with a filter added that narrows the results to only include products where the
Title field contains the word “Hat”:
- Filtering documentation
- Getting started with Metabase
- Adding filters to dashboards with SQL questions
- Linking filters in dashboards
- Cross-filtering: using a chart to update a dashboard filter
Did this article help you?
Thanks for your feedback!