Skip to main content
All CollectionsUser Guides
Dashboard: Data filters
Dashboard: Data filters

Filter your dashboard’s data based on the variable’s values or context.

Santiago Pachon Robayo avatar
Written by Santiago Pachon Robayo
Updated over 2 months ago

How many times have you been in a position where you’d like to, for example, have the Map widget or the Devices Table to only display devices that meet a certain condition, either based on its variable’s values or context? Or have the Metric-type widgets (Bar chart, Battery, Gauge, Indicator, Metric, Tank, Temperature, and Variables Table) show their last or aggregated values after filtering them based on a value or context condition?

Well, with Dashboards filters, applying such conditions to your devices’ data is now possible.

image.png

Requirements

  1. Active Ubidots account with at least an Industrial license.

1. Filters explanation

There are 2 types of filters, value and context. The first type filters the data displayed in the dashboard based on values, whereas the second uses variable context as the filter input.


Let’s see an example of both of them. To do this, take the following raw time-series data as an example:

Timestamp

Value

Context

2022-06-13 15:35:00 -05:00

10

{"status": "too-cold"}

2022-06-13 15:30:00 -05:00

20

{"status": "cold"}

2022-06-13 15:25:00 -05:00

30

{"status": "cold"}

2022-06-13 15:20:00 -05:00

40

{"status": "cold"}

2022-06-13 15:15:00 -05:00

50

{"status": "good"}

2022-06-13 15:10:00 -05:00

60

{"status": "good"}

2022-06-13 15:05:00 -05:00

70

{"status": "good"}

2022-06-13 15:00:00 -05:00

80

{"status": "hot"}

2022-06-13 14:55:00 -05:00

90

{"status": "hot"}

2022-06-13 14:50:00 -05:00

100

{"status": "too-hot"}

First, if we apply a value filter that brings back values greater or equal to 50 (≥ 50), the resulted time series is as shown below. Note that, in the time span, only the values greater or equal to 50 are retrieved.

Timestamp

Value

Context

2022-06-13 15:15:00 -05:00

50

{"status": "good"}

2022-06-13 15:10:00 -05:00

60

{"status": "good"}

2022-06-13 15:05:00 -05:00

70

{"status": "good"}

2022-06-13 15:00:00 -05:00

80

{"status": "hot"}

2022-06-13 14:55:00 -05:00

90

{"status": "hot"}

2022-06-13 14:50:00 -05:00

100

{"status": "too-hot"}

If we now apply a context filter to the initial time series, so it only retrieves values whose “status” context key is equal to “too-hot”, the resulting time series will be:

Timestamp

Value

Context

2022-06-13 14:50:00 -05:00

100

{"status": "too-hot"}

The above examples only retrieve the raw time series after applying the filter, but Ubidots’ widgets also support aggregations such as average, max, min, sum, or count. For such cases, the aggregation will be computed after applying the filter to the raw time-series data. For example, let’s assume an “average” aggregation for a value-based filter condition greater or equal to 50 (≥ 50). The resulting time series will be:

Timestamp

Value

Context

2022-06-13 15:15:00 -05:00

50

{"status": "good"}

2022-06-13 15:10:00 -05:00

60

{"status": "good"}

2022-06-13 15:05:00 -05:00

70

{"status": "good"}

2022-06-13 15:00:00 -05:00

80

{"status": "hot"}

2022-06-13 14:55:00 -05:00

90

{"status": "hot"}

2022-06-13 14:50:00 -05:00

100

{"status": "too-hot"}

And the average will be simply 75.


2. Type of filters

To create filters in your dashboards, simply head to the Dashboard’s settings, and you’ll find the option to create either of the types of filters down at the bottom of the Settings tab:

image.png

2.1. Values filters

The below steps describe how to set up a value-type filter:

Step 1: Select the Value option.
Step 2: Fill the 3 options as follows:

  • Name: This will be the visible name in the dashboard.

  • Icon code: Fontawesome’s icon name. This icon will be shown left of the filter name.

  • Variable label: The variable label upon which the filter will be applied. It can be a single variable or a comma-separated list of variables. If left blank, the filter will be applied to all variables available in the widgets of the dashboard.

Step 3: Click on Save.

Here’s how a value filter configuration that takes as input a variable labeled as “temperature”, looks like:

image.png

From the dashboard, you’ll see a new dropdown option name “Temperature” with a half-filled thermometer icon, that after clicking it, it allows entering a filter with the options:

  • Equal (=)

  • Not equal (≠)

  • Greater than or equal (≥)

  • Greater than (>)

  • Less than or equal (≤)

  • Less than (<)

image.png

2.2. Context filters

The below steps describe how to set up a context-type filter:

Step 1: Select the Context option.
Step 2: Fill the 3 options as follows:

  • Name: This will be the visible name in the dashboard

  • Icon code: Fontawesome’s icon name. This icon will be shown left to the filter name

  • Variable label: The variable label upon which the filter will be applied. It can be a single variable or a comma-separated list of variables. If left blank, the filter will be applied to all variables available in the widgets of the dashboard

  • Context key: The context key to evaluate its value against to.

  • List options: The value options, separated by a comma, to display in the dashboard with the following structure: “Display name <context value>”. By default, Ubidots makes the list “All <*>, Not set <none>”.

Step 3: Click on Save.

Here’s how a context filter configuration that takes as input a variable labeled as “temperature” and a its “status” context key, looks like:

image.png

From the dashboard, you’ll see a new dropdown option name “Status” with a thermometer icon, that after clicking it, it allows selecting among the different context value options:

image.png

3. Impact on Metric-type widgets

Metric-type widgets are:

  • Bar chart

  • Battery

  • Gauge

  • Indicator

  • Metric

  • Tank

  • Temperature

  • Variables table

  • Pie chart

The impact of filters on these widgets will depend on their “aggregation” configuration, as follow:


– Last value: will retrieve the first value, from newest to oldest, to match the filter condition in the selected time span.
– Aggregation: if average, min, max, sum or count is selected, the computation will be applied to the output of the filter in the selected time span.

4. Impact on the Device table and Map widgets

The impact of filters on the Device table widget will depend on the configuration of the columns:

Context data column: If a context filter is applied, the device table widget will retrieve the first value of the context key associated, from newest to oldest which matches the filter context condition in the selected time span.

Value column: The impact of filters will depend on their “aggregation” configuration, as follow:


– Last value: will retrieve the first value, from newest to oldest, to match the filter condition in the selected time span.
– Aggregation: if average, min, max, sum or count is selected, the computation will be applied to the output of the filter in the selected time span.

5. Impact on other widgets

The widgets can be applied to widgets that visualize time series data, such widgets can be:

  • Histogram

  • Line chart and double axis

The filters on these widgets will show the line chart or histogram of the resulting time series after the filters have been applied.

Did this answer your question?