Understanding aggregate functions

1

.

Explanations & instructions

An aggregate function is a calculation that is performed on multiple values in a given time interval, the result is one value.

Why is this important? Because the values are compressed when displayed in a widget. Displaying each individual value would create an unclear and complex result, from which it is difficult to draw conclusions.
There is usually more interested in knowing whole numbers than in details. When you zoom in on the widget timeline, you see more individual data points.

A widget offers 8 ways to compress your data:

COUNT

COUNT shows the number of values sent in the time interval. It works on both numeric values and character strings (=text).

AVG

AVG shows you the average value in the time interval. It is usually used to get an overview of a situation, or when it is important to know averages.

MAX

MAX shows the largest value it received in the time interval. Useful when checking an upper limit, for example.

MIN

MIN shows the smallest value in the time interval. Useful when checking a lower limit, for example.

FIRST

FIRST displays the first value received in the time interval.

LAST

LAST shows the last value received in the time interval.

DIFF

DIFF calculates the difference between the first and last values in the time interval. This function is useful when your sensor counts totals, and you want to know the rise or fall of your values.

SUM

SUM calculates the sum of all values received in the time interval. This function is useful when your sensor is a counter, for example, and you want to know totals.

Example: Let's say your sensor counts counts water consumption in liters.

Within a time interval, it transmits the following values:

1 1 1 2 0 1 0 2 3

Depending on the calculation set, your widget will display the following value:

COUNT

= 8

AVG

= 1.25

MAX

= 3

MIN

= 0

FIRST

= 1

LAST

= 3

DIFF

= 2

SUM

= 10

Please note! In order to know when to use SUM or DIFF, it is important that you know the way your sensor measures the value.

Example

  • If you get the following values: 1 1 0 2 you can use SUM to get the total of the measured values.

  • If you get the following values: 1 3 4 5 the sensor will sum the values itself. You can also use DIFF to know by how much the values have changed. The calculation looks like this DIFF (5 - 1 = 4)

Example

This is a graph with data from a single sensor, so exactly the same measurement path, but with three different aggregations.

  • The red line shows the maximum (#MAX) measured temperature.
  • The green line shows the average (#AVG) value.
  • The blue line shows the minimum (#MIN) measured temperature.

2

.

How to use aggregation functions in your widgets

When setting up a widget, you can choose a maximum number for the data points to be displayed.

Data points are the values that the sensor sends to the portal. Over time, these values are compressed for greater clarity. The compression of the data points is controlled by the "Max Data Points" setting. The higher the maximum you set, the more data points will be displayed on your widget and the less they will be compressed.

For example:

  • A column chart with "Max Data Points" set to 100:

  • The same graph with "Max Data Points" set to 20:

When compressing multiple sensor values, the value displayed in the widget is determined by the aggregate function.

If you do not select aggregation, the default is set to "LAST."

Need Support?

Can’t find the answer you’re looking for? Don’t worry we’re here to help!

Ask For Help
Language Choice Disclaimer

These texts have been automatically translated using advanced AI translation tools. If you notice any inaccuracies or errors, please help us improve by sending a message to hello@calculus.group. Your feedback assists us in enhancing the quality of our multilingual documentation.