Skip to content
Snippets Groups Projects
Unverified Commit 92e4964f authored by Jeff Bruemmer's avatar Jeff Bruemmer Committed by GitHub
Browse files

docs - update filters (#35963)

parent beb2642d
No related branches found
No related tags found
No related merge requests found
......@@ -10,14 +10,21 @@ redirect_from:
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 add [filter widgets](#filter-widgets) to let people change variables for cards on a dashboard.
Instead of creating duplicate dashboards, you can add filter widgets to let people change variables for cards on a dashboard.
## Adding a new filter
To add a filter to a dashboard, first click the **pencil icon** to enter dashboard editing mode, then click the **Add a Filter** button that appears in the top-right. Dashboard filters apply across all [dashboard tabs](./introduction.md#dashboard-tabs), though you'll need to connect filters to each card you want to filter.
![Add a Filter](./images/add-filter.png)
- Click the **pencil icon** to enter dashboard editing mode.
- Click the **filter icon** that appears in the top-right to add a filter.
- Select a [filter type](#filter-types).
- [Connect your filter](#connecting-a-filter-to-dashboard-cards) to one or more dashboard cards.
- [Configure your filter](#editing-a-filter).
- **Save** your changes.
### Filter types
You can choose from a number of filter types:
- [Time](#time-filters)
......@@ -26,9 +33,9 @@ You can choose from a number of filter types:
- [Number](#number-filter)
- [Text or categories](#text-or-category-filter)
The type of filter you choose will determine what the [filter widget](#filter-widgets) will look like, as well as which fields you’ll be able to filter your cards by:
The type of filter you choose will determine how the filter works, as well as which fields you’ll be able to filter your cards by:
### Time filters
#### Time filters
When picking a Time filter, Metabase will prompt you to pick a specific type of filter widget:
......@@ -41,7 +48,7 @@ When picking a Time filter, Metabase will prompt you to pick a specific type of
Single Date and Date Range will provide a calendar widget, while the other options all provide slightly different dropdown interfaces for picking values. To get a widget that's just like the time filter in the query builder, choose All options.
### Location filters
#### Location filters
There are four types of Location filters to choose from:
......@@ -50,11 +57,11 @@ There are four types of Location filters to choose from:
- ZIP or Postal Code
- Country
### ID filter
#### ID filter
The ID filter provides a simple input box where you can type the ID of a user, order, etc.
### Number filter
#### Number filter
You can choose from:
......@@ -64,133 +71,133 @@ You can choose from:
- Greater than or equal to
- Less than or equal to
### Text or category filter
#### Text or category filter
A flexible filter type that will let you create either a dropdown menu or an input box to filter on any category field in your cards. Options include:
- **Is**. Select one or more values from a list or search box.
- **Is**. Select one or more values from a list or search box. Use **Is** when you just want to plug a value into a variable. For multiple values, the card must be either a question built using the query builder, or a native/SQL question using a [field filter](../questions/native-editor/sql-parameters.md#the-field-filter-variable-type).
- **Is not**. Exclude one or more specific values.
- **Contains**. Match values that contain the entered text.
- **Does not contain**. Filter out values that contain the entered text.
- **Starts with**. Match values that begin with the entered text.
- **Ends with**. Match values that end with the entered text.
## Filtering dashboards with native/SQL questions
## Connecting a filter to dashboard cards
If you're trying to filter native/SQL questions, you'll need to [add a bit of additional markup to your query](../questions/native-editor/sql-parameters.md) in order to use a dashboard filter with that question. For an in-depth article on this, check out [Adding filters to dashboards with SQL questions](https://www.metabase.com/learn/dashboards/filters).
Dashboard filters apply across all [dashboard tabs](./introduction.md#dashboard-tabs), though for each filter you add, you'll need to tell Metabase which column the filter should update for each card.
## Example filter
Click on a card's dropdown menu to select the field that you want the widget to filter on.
Let's add a filter widget to our dashboard. We'll select a **Text or Category** filter, and then select the **Is** option to select one or more values from a list.
Here we've wired up a Text filter to the "Event types" card, telling Metabase that the column to filter on should be the `Analytics.Event.Button.Label` field:
Metabase will display a filter editing sidebar where you can wire up your new filter to each applicable card. Each card will feature a dropdown menu where you can select the column to filter. The sidebar on the right displays the settings for the current filter.
![Wiring up a dashboard filter to a card](./images/wiring-cards.png)
If there’s a card on your dashboard that you don’t want to use with the filter, or that doesn’t make sense to use with the filter, that’s okay — the filter will only be applied to the cards you select.
## Auto-connecting filters to cards
Here we've wired up a Text filter to a card on the `Analytics.Event.Button.Label` field:
If there are other cards that also have the field you select, Metabase will automatically connect the filter to those cards too (including cards on other tabs). If you later add a card with the selected field, Metabase will also try to connect that filter to the new card.
![Wiring up a dashboard filter to a card](./images/wiring-cards.png)
To undo this auto-connecting of cards, click on the toast that pops up when Metabase auto-connects the cards, or manually disconnect the cards by clicking on the "X" next to the connected field.
Before we **Save** our changes, we can edit our filter's settings.
## Filtering dashboards with native/SQL questions
If you're trying to connect a filter to a card with a native/SQL questions, you'll need to [add a variable or field filter to your query](../questions/native-editor/sql-parameters.md). For an in-depth article, check out [Adding filters to dashboards with SQL questions](https://www.metabase.com/learn/dashboards/filters).
## Wiring up dashboard filters to text cards
You can even wire up filters to text cards, but only if [the text card includes a variable](./introduction.md#including-variables-in-text-cards).
## Editing a filter
To access a filter's settings:
To edit a filter's settings:
1. Click the **pencil** icon to enter dashboard editing mode.
2. Click the **gear** icon on the filter you want to edit.
From this filter editing view, you can wire up individual dashboard cards to the filter, or use the settings in the sidebar to:
From this filter editing view, you can wire up dashboard cards to the filter, or use the filter settings sidebar to:
- [Remove a filter](#remove-a-filter)
- [Reorder filter widgets](#reorder-filter-widgets)
- [Rename filter](#rename-filter)
- [Set filter input type](#set-filter-input-type)
- [Set a default filter value](#set-a-default-filter-value)
- [Remove a filter](#remove-a-filter)
- [Reorder filters](#reorder-filters)
- [Make a multi-select filter](#make-a-multi-select-filter)
- [Change the filter widget type](#filter-widgets)
- [Change a filter's selectable values](#change-a-filters-selectable-values)
### Remove a filter
### Rename filter
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, click **Remove**.
2. Change the label text.
If you accidentally remove a filter, just click **Cancel** in the top-right to exit dashboard edit mode without saving your changes.
### Reorder filter widgets
Renaming the filter only affects the filter's display; the label has no effect on which columns Metabase filters.
In dashboard edit mode, click on the grabber handle (six dots) on the left side of a filter widget, then drag the widget to a different position.
### Set a default filter value
### Set filter input type
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, choose a value from the **Default value** input field.
For example, you might want to set a default filter value like "Active", so that when people load your dashboard, they only see data for "Active" records (not "Inactive", "Cancelled", etc).
2. From the filter settings sidebar, set **How should people filter on this column?**:
### Make a multi-select filter
- [Dropdown list](#dropdown-list)
- [Search box](#search-box)
- [Input box](#plain-input-box)
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, find **Users can pick** and select "Multiple values".
#### Dropdown list
A multi-select filter with the widget type [Dropdown list](#dropdown-list) or [Search box](#search-box) will display a list of values with checkboxes.
### Change a filter's selectable values
A list of all of the possible values in a column. People can use checkboxes to select more than one value on [multi-select filters](#make-a-multi-select-filter). You should choose the dropdown widget if you want the list of filter values to load instantly (from cache).
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, find **How should users filter on this column?**.
3. Select "Dropdown list".\*
4. Click **Edit** (to the right of "Dropdown list") to specify where the values should come from:
- From connected fields
- From another model or question
- Custom list
If you're not seeing the **Dropdown list** option, and your dashboard filter is based on a column from a:
![Selectable values](./images/selectable-values.png)
- Table or GUI model: an admin will need to [enable the dropdown widget](../data-modeling/metadata-editing.md#changing-a-search-box-filter-to-a-dropdown-filter) for that column from Metabase's **Admin settings**.
- SQL model: go to your [model's metadata settings](../data-modeling/models.md#add-metadata-to-columns-in-a-model), find your column, and set the **Database column this maps to**.
\* If you don't see "Dropdown list" as an option, go to [Filter widgets: Dropdown list](#dropdown-list) for more info.
#### Search box
## Using filters
A search box that suggests a list of matching filter values as you type. The suggestion list will display checkboxes for [multi-select filters](#make-a-multi-select-filter).
Once you’ve added a filter to your dashboard, just click on the filter widget to select a value and activate the filter. To stop filtering, just click the blue X.
The search box is a good choice for most columns containing labels, categories, statuses, and so on. It's is the default filter widget for columns with less than 100 unique values.
Your active filter will only apply to your view of the dashboard. If someone else is viewing the same dashboard link at the same time, they won't see your filter.
#### Plain input box
![Using a filter](./images/use-filter.png)
You can also set up a dashboard question to [update a filter on click](./interactive.md#use-a-chart-to-filter-a-dashboard).
An input box that lets people enter plain text (no suggestion list).
## Filter widgets
Useful for looking up partial matches (such as the ["contains" filter](#text-or-category-filter)) in columns that contain free text, such as comments or descriptions. The input box is the default filter widget for columns with more than 100 unique values.
The filter widget is the little box at the top of your dashboard which people will use to enter their filter values.
### Set a default filter value
You can find a filter's widget settings from dashboard edit mode (**pencil** icon), then clicking on a filter widget's **gear** icon.
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, choose a value from the **Default value** input field.
From the filter settings sidebar, you'll find the widget types under **How should people filter on this column?**:
For example, you might want to set a default filter value like "Active", so that when people load your dashboard, they only see data for "Active" records (not "Inactive", "Cancelled", etc).
- [Dropdown list](#dropdown-list)
- [Search box](#search-box)
- [Input box](#plain-input-box)
### Remove a filter
### Dropdown list
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, click **Remove**.
A list of all of the possible values in a column. People can use checkboxes to select more than one value on [multi-select filters](#make-a-multi-select-filter). You should choose the dropdown widget if you want the list of filter values to load instantly (from cache).
If you accidentally remove a filter, just click **Cancel** in the top-right to exit dashboard edit mode without saving your changes.
If you're not seeing the **Dropdown list** option, and your dashboard filter is based on a column from a:
### Reorder filters
- Table or GUI model: an admin will need to [enable the dropdown widget](../data-modeling/metadata-editing.md#changing-a-search-box-filter-to-a-dropdown-filter) for that column from Metabase's **Admin settings**.
In dashboard edit mode, click on the grabber handle (six dots) on the left side of a filter widget, then drag the widget to a different position.
- SQL model: go to your [model's metadata settings](../data-modeling/models.md#add-metadata-to-columns-in-a-model), find your column, and set the **Database column this maps to**.
### Make a multi-select filter
### Search box
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, find **People can pick** and select "Multiple values".
A search box that suggests a list of matching filter values as you type. The suggestion list will display checkboxes for [multi-select filters](#make-a-multi-select-filter).
A multi-select filter with the widget type [Dropdown list](#dropdown-list) or [Search box](#search-box) will display a list of values with checkboxes.
The search box is a good choice for most columns containing labels, categories, statuses, and so on. This is the default filter widget for columns with less than 100 unique values.
### Change a filter's selectable values
### Plain input box
1. In dashboard edit mode, click your filter's **gear** icon.
2. From the sidebar, find **How should users filter on this column?**.
3. Select "Dropdown list".\*
4. Click **Edit** (to the right of "Dropdown list") to specify where the values should come from:
- From connected fields
- From another model or question
- Custom list
An input box that lets people enter plain text (no suggestion list).
![Selectable values](./images/selectable-values.png)
Useful for looking up partial matches (such as the ["contains" filter](#text-or-category-filter)) in columns that contain free text, such as comments or descriptions. The input box is the default filter widget for columns with more than 100 unique values.
\* If you don't see "Dropdown list" as an option, go to [Filter widgets: Dropdown list](#dropdown-list) for more info.
## Linking filters
......@@ -204,25 +211,32 @@ To link filters, you'll need to set up this parent-child relationship. And you s
Here you can limit the current filter's choices. If you toggle on one of these dashboard filters, selecting a value for that filter will limit the available choices for this filter. In this case, we toggle on the state filter (the parent), to limit the choices for the city filter. When states are selected, the city filter will limit its choices to cities in those states. Click **Done**, then **Save** to save the dashboard.
To learn more, check out [Linking filters in dashboards](https://www.metabase.com/learn/dashboards/linking-filters).
### Limitations of linking filters
- Native/SQL questions must have a [field filter](../questions/native-editor/sql-parameters.md#the-field-filter-variable-type) variable in order to be linked. Regular SQL variables won't work.
- You can't link filters that use "Custom List" or "From another model or question" as their value's source.
To learn more about linked filters, check out [Linking filters in dashboards](https://www.metabase.com/learn/dashboards/linking-filters).
## Auto-apply filters
By default, each time you change the value in a filter on a dashboard, the dashboard will refresh to get the results of each card with that new filter value applied.
If a dashboard is particularly large or slow, or you have multiple filters that you want to adjust, you may want to tell Metabase when to refresh the dashboard.
If a dashboard is particularly large or slow, or you have multiple filters that you want to adjust before the dashboard refreshes its results, you may want to tell Metabase when to apply those filters and refresh the dashboard.
To turn off the automatic application of filters, click on the info **i** icon, and toggle the **Auto-apply filters** option. With auto-apply turned off, each time you change a value in a filter, you'll need to click the apply button to refresh the dashboard with the new filter value.
To turn off the automatic application of filters, click on the info **i** icon, and toggle the **Auto-apply filters** option. With auto-apply turned off, each time you change a value in a filter, you'll need to click the **Apply** button to refresh the dashboard with the new filter value.
![Click Apply to apply the filters and refresh the dashboard](./images/apply-button.png)
## Best practices
## Using filter widgets
Once you’ve added a filter to your dashboard, just click on the filter widget to select a value and activate the filter. To stop filtering, just click the blue X.
Here are a few tips to get the most out of dashboard filters:
Your active filter will only apply to your view of the dashboard. If someone else is viewing the same dashboard link at the same time, they won't see your filter.
- **Limit filters to 3 or fewer**. Limiting filters will make it easier for your teammates to quickly understand what options are available to them when viewing your dashboard.
- **Start with a new dashboard**. While you can add dashboard filters to an existing dashboard with a bunch of cards in it, it can be easier to start a new dashboard and think about what filters you intend to add to it. That way you can make sure that you only put cards in that dashboard that can be used with the filters. Alternatively, you could duplicate an existing dashboard, and pare down the number of cards.
- **Link filters** so people don't have to sift through irrelevant filter options (like cities not in a filtered state).
![Using a filter](./images/use-filter.png)
You can also set up a dashboard question to [update a filter on click](./interactive.md#use-a-chart-to-filter-a-dashboard).
## Further reading
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment