Navigation
This documentation refers to the MongoDB Charts service in MongoDB Atlas. Read the on-premises documentation to learn how to use the MongoDB Charts on site.

Filter Dashboards by Field Values

Dashboard Filters

Dashboard filters refine data across all charts in a dashboard, allowing you to view a common subset of data in all of a dashboard’s charts.

Dashboard Authors or Owners set the fields that any dashboard users can filter data with. Authors or Owners can also set initial default values for each filter. All dashboard users can filter based on values they specify and save their own default filter values.

Note

Users who open a dashboard using a public link can’t save their own default filter values. Charts reverts to the initial default filter values after refreshing the page or starting a new session.

An image of a dashboard. Two filter cards are highlighted. The charts only display data that corresponds to the selected field values.

Note

Dashboard Authors or Owners define filters using specific data sources. A single filter might not refine all charts if the dashboard contains charts mapped to data sources that the filter doesn’t use.

Example Scenario

A dashboard Author creates a dashboard with charts that contain sales data for all of a company’s customers. The author creates a filter allowing dashboard viewers to select which region(s) to display data from. Members of a sales team use this filter to display customer data only for the region(s) that they cover.

Filter Persistence Per Dashboard Viewer

Charts persists the following states for each dashboard viewer across reloads and user sessions:

  • which filters are enabled or disabled
  • field values chosen to filter dashboards
  • whether the Dashboard Filters is expanded or collapsed.

The changes that a dashboard viewer makes to filters don’t affect other Charts users. A viewer’s saved filters are not affected when a dashboard Author or Owner modifies a filter’s default values unless you reset a filter.

Note

Charts doesn’t persist filter states or values for users who open a dashboard using a public link. Charts reverts to the initial default filter values after refreshing the page or starting a new session.

The Dashboard Filters Pane

The Dashboard Filters icon indicates the number of active filters. Click the icon to expand the Dashboard Filters pane.

An image of a dashboard. The :guilabel:`Dashboard Filters` icon is highlighted.

The Dashboard Filters pane displays a filter card for each field you can use to filter chart data. You can configure filter cards to use related fields from multiple data sources. When you update a field value, Charts updates dashboard charts to display data that matches the field values you provide from all configured data sources.

In the following example, a dashboard Author creates filters on the genres and year fields from two sample movie datasets. The Author sets default values for these fields to only display Science Fiction and Horror movies released in or after 1968. Dashboard Viewers can provide their own values for the filterable fields to refine chart data based on their interests.

An image of a dashboard. The :guilabel:`Edit Dashboard Filters` pane is highlighted.

To learn about filtering options for each field data type, see Create Filters for Your Data.

Manage Dashboard Filters

Dashboard Authors and Owners can add, edit, and delete dashboard filters.

Add Dashboard Filters

You can specify fields that any dashboard users can filter data with. When you create a dashboard filter, you select related fields from the data sources that a dashboard chart uses. You can add dashboard filters based on any number of data sources that a dashboard chart uses.

Filter cards that use multiple data sources query each chart using the name of the field from the applicable data set.

Example

Chart A uses data set A. Chart B uses data set B. Field A in data set A and field B in data set B contain related information. You add both fields to a single filter card.

When a filter affects chart A, the query for that chart uses field A only. When a filter affects chart B, the query for that chart uses field B only.

To add a dashboard filter:

  1. Expand the Dashboard Filters pane on the desired dashboard.

  2. If a dashboard has no filers, click Add Filters. Otherwise, click Edit.

  3. Expand a data source that contains fields you want to add a filter for.

  4. Drag a field from the data source to the + filter drop zone.

    Tip

    To search for specific data fields, use the search bar at the upper left corner of the Edit Dashboard Filters pane.

    The data source name appears below the field name in the filter card.

  5. (Optional) You can stack fields from other data sources. This allows you to use a single filter to refine chart data from related fields from multiple data sources.

    To stack fields in a filter card:

    • Each field must be of the same data type as the other fields on the filter card.
    • The filter card must not have another field from the selected data source on it.

    To stack fields from other data sources:

    1. Expand another data source that contains a related field.
    2. Drag a field from the data source to the + another field drop zone on the same filter card.

    The data source name appears below the field name and the other data sources you selected fields from in the filter card.

    Note

    The field names might differ from each data source. The filter card lists the field name you used to create the filter.

    Click trash icon next to a data source to remove its field from a filter card.

  6. (Optional) Supply default values for the field in the filter card. All dashboard viewers see chart data that matches the default field values you provide until they provide their own filter values or disable the filter card.

    The filter card options are based on the data type of the field. To learn about filtering options for each field data type, see Create Filters for Your Data.

  7. Use the toggle to disable or enable the filter card by default. If disabled, each dashboard user must enable the filter card to display data the filter refines.

  8. Repeat for each field you want users to filter data by.

  9. Click Apply Filters.

Edit Dashboard Filters

After you create a dashboard filter, you can:

  • Enable or disable filter cards.
  • Add or remove fields.
  • Stack fields from other data sources.
  • Change the default field values.

To edit a dashboard filter:

  1. Expand the Dashboard Filters pane on the desired dashboard, then click Edit.
  2. Make the changes you want to each filter card.
  3. Click Apply Filters.

Delete Dashboard Filters

  1. Expand the Dashboard Filters pane on the desired dashboard, then click Edit.
  2. Hover of the filter card you want to delete, then click trash icon .
  3. Click Apply Filters.

Use Dashboard Filters

Any user with at least the Viewer role on a dashboard and the data source backing a field can view the filter card and provide their own values for the filter.

Filter Dashboards

You can filter the dashboard data based on the filterable fields that an Author or Owner configured. Charts filters data based on default field values if the dashboard Author or Owner configured them. Dashboard Authors or Owners can configure filter cards to use related fields from multiple data sources. You can provide your own field values to customize the data the charts display.

To filter dashboard data based on filterable fields:

  1. Expand the Dashboard Filters pane on the desired dashboard.

  2. If a filter card is disabled, click the toggle to enable it.

  3. Modify the values of the provided fields to update the dashboard’s charts based on the filter values you provided.

    The filter card options are based on the data type of the field. To learn about filtering options for each field data type, see Create Filters for Your Data.

    Note

    If the filter card field is a String or ObjectId, Charts only samples field values from the first data source that was added to the filter.

    Updating the filter value refines chart data based on all data sources linked to the filter card.

The charts refresh immediately after you modify a field value.

Revert Dashboard Filters to Default Values

To revert a filter card to its default values, click undo icon .