Have you ever found yourself in a situation where it seems like you need to create nearly identical copies of the same dashboard, with just one different variable? Maybe you have an Earnings dashboard, but you want to see the data for each city your business is in, or maybe you have a KPI dashboard that you want to see broken out by month.
Instead of creating duplicate dashboards, you can use Metabase’s dashboard filters feature to create simple toggles to change a variable for all the cards on a dashboard.
To add a filter to a dashboard, first enter dashboard editing mode, then click the Add a Filter button that appears in the top-right.
You can choose from a number of filter types: Time, Location, ID, or Other Categories. The type of filter you choose will determine what the filter widget will look like, and will also determine what fields you’ll be able to filter your cards by:
Note: If you’re trying to filter Native/SQL questions, you’ll need to add a bit of additional markup to your query in order to use a dashboard filter with that question.
For our example, we’ll select a Time filter, and then select the Month and Year option.
Now we’ve entered a new mode where we’ll need to wire up each card on our dashboard to our new filter. If there’s a card on your dashboard that you don’t want to use with the filter, or that it doesn’t make sense to use with the filter, that’s okay — the filter will only be applied to the cards you’ve selected.
So here’s what we’re doing — when we pick a month and year with our new filter, the filter needs to know which field in the card to filter on. For example, if we have a
Total Orders card, and each order has a
Date Ordered as well as a
Date Delivered, we have to pick which of those fields to filter — do we want to see all the orders placed in January, or do we want to see all the orders delivered in January? So, for each card on our dashboard, we’ll pick a date field to connect to the filter. If one of your cards says there aren’t any valid fields, that just means that card doesn’t contain any fields that match the kind of filter you chose.
Before we click the
Done button at the top of the screen, we can also customize the label of our new filter by clicking on the pencil icon next to it. We’ll type in a new label and hit enter. Now we’ll click
Done, and then save the changes to our dashboard with the
To edit a filter, enter dashboard editing mode, then click the
Edit button on the filter you want to change. You an also click
Remove to get rid of a filter. If you do this by accident, just click
Cancel in the top-right to exit dashboard editing mode without saving your changes. To reorder your filters, just click on the grabber handle on the left side of a filter and drag it to a different position.
If you want one of your filters to start with a default value when you load the dashboard it’s in, while in filter editing mode just click on the filter to select a value. Click the blue X if you want to remove the default value.
Once you’ve added a filter to your dashboard, just click on it to select a value and activate the filter. To stop filtering, just click the blue X. To change the filter, click anywhere else on it.
Picking selections for a filter with lots of options is easier than ever before. If the field you’re using for a filter has more than 100 unique values, you’ll now automatically see a search box with autocomplete suggestions.
Fields with fewer than 100 distinct values will have display a list of all the options.
In both cases, you can pick one or multiple selections for your filter.
If Metabase somehow picked the wrong behavior for your field, admins can go to the Data Model section of the admin panel and click on the gear icon by the field in question to manually choose between a list, a search box, or just a plain input box.
Here are a few tips to get the most out of dashboard filters:
We’ll learn how to create charts with multiple lines, bars, and more next.