Filtering data

There are several ways to filter data rendered in a dashboard:

  • Static filter in a widget: this lets you define a filter in a single widget. The viewer can't modify the filter. You can define several static filters in a widget.
  • Dynamic filter in a widget: this lets you define an editable filter in a widget. The viewer will be able to use it to filter the data displayed in the widget. You can add several dynamic filters per widget.
  • Dynamic filter widget: this is a particular widget used to encapsulate dynamic filters applied to a full tab. A viewer can use this filter widget to filter the data of a given tab.
  • Global static filter: used to define a filter on a datasource in a dashboard. This filter will be applied to all widgets using this datasource in all the tabs of the dashboard. The value used in a global static filter can be defined in the dashboard. But it can also be passed dynamically to the dashboard. In this second case, the dashboard is called a template dashboard. See here for the documentation about this option.

Static filter in a widget

In the Filter section of a widget configuration, to define a filter, you need to select the dimension, operator and value.

Using date/time filters

For date/time dimension, you can use special filters: the same as in data sources formulas.

Using In/Not in filters

When using the In operator, you must provide a list of string or integer values.

Examples:

  • filtering specific ids:
1
[42, 567, 4095]
  • filtering specific quarters:
1
["Q1", "Q3"]

When you are using a dashboard template, you can use the special value "$$all$$" in In filters payloads to provide an admin dashboard with all the data.

Dynamic filter in a widget

In the Filter section of a widget, you just need to select the dimension you want to filter on. It will automatically add a selector at the top of the widget to let you or a viewer filter the widget. You can add as many filtering dimensions as you need per widget.

Dynamic filter widget

To add a filter bar, click on the Filter Widget icon in the list of widget types. This adds a new empty widget. In the widget configuration, click on the '+' to add a new filter. This adds a new item in the filter list below.

Click on the item added in the list, and select the source and the dimension you want to filter on. If you want this filter to be applied to other datasources, click on the button "+ source and measure". This is useful for example when you want to filter per country and you want to filter with the selected value in several datasources.

Using dynamic filters to define a variable

By default, when a dynamic filter is used, the widget(s) will be modified according to the value of the filter.

If you activate the Store selected value as variable option, the selected value of the filter will only be stored in a variable but no filtering will be applied to the widget(s).

To apply the value to the widget(s), you need to use the defined variable within static filters. This lets you use a formula to modify the filtered value before passing it to the static filtering.

Example:

Let's say you have a column month with the format YYYY-MM (e.g. 2017-07) and you create a dynamic filter widget using this column, with the option Store selected value as variable enabled (using myMonth as the variable name).

To show data of the selected month within a first widget, you can create a static filter on column month with operator == and with value {{myMonth}}.

To show data of the month before the selected month within a second widget, you can create a static filter on column month with operator == and with value {{dateAdd(myMonth, -1, "month", "YYYY-MM")}}.

Specify the list of widgets IDs to filter

By default, a dynamic filter will be applied to all widgets in its tab. If you need, you can specify to apply a given filter only to a set of widgets.

To do that, enter the list of ID in the field IDs of widgets to filter. You must provide it as a comma separated list, e.g. 3,10,7 to filter widgets 3, 10 and 7.

To retrieve the ID of a widget, open the design tab and then open the Advanced Styles Editor. The ID of the selected widget will be displayed.

Global static filter

In the global options of the dashboard (last configuration tab), global static filters can be created in the Global filters section. You need to select each datasource you want to filter in the dashboard, the dimension you want to filter and the value. Once a filter is created here, all widgets in all tabs of the dashboard will be filtered.

In the list of datasources, the icon ✓ means the datasource has a global static filter applied. This helps you to quickly find datasources having a filter. Note that only the datasources being used in the dashboards appear in this list.

Using variables in global static filters

Instead of entering a value in a global static filter, you can use a variable. For example, you can type {{myId}} in the value field of the filter.

Then, there are two ways to fill this variable:

  • in the Dashboard variables field, you can enter a JSON containing the values:
1
2
3
4
{
  "myId": 10,
  "myOtherParameters": "France",
}

This is particularly useful when you clone a dashboard. You can modify a variable and display a completely different set of data.

  • or you can dynamically pass a payload to the dashboard (i.e. pass the variables only when the dashboard is opened by a viewer). In this second case, the dashboard is called a template dashboard. See here for the documentation about this option.