TABLE DES MATIÈRES
Introduction
The "Average Week" function is used to determine the typical weekly profile of a time series collected via a sensor. It calculates the average value for each time interval of a week from historical data.
Prerequisites
This function requires sensors to be configured on a site, and optionally labeled. These sensors must have at least a daily time step (day, hour, 30 minutes, 10 minutes, etc.).
Usage
To obtain the results of the average week, set up an indicator by entering the formula AVERAGE_WEEK(XXX)
. Once entered correctly, the text turns green, and the frame surrounding the formula changes from red to blue. If not, there is at least one syntax error (pay attention to capitalization and parentheses).
XXX can be:
- A sensor (directly called using @ Tele-retrieved data)
- Another available function:
- Classical formulas:
MIN(xxx)
,MAX(xxx)
,COUNT(xxx)
- Sensor by Label algorithm formulas:
SUM_SENSOR_LABELS(label)
,AVERAGE_SENSOR_LABELS(label)
,MIN_SENSOR_LABELS(label)
,MAX_SENSOR_LABELS(label)
- Classical formulas:
However, the AVERAGE_WEEK
formula cannot be used as a parameter in other functions.
Examples of possible settings | Examples of impossible settings |
AVERAGE_WEEK(sensor) | MAX(AVERAGE_WEEK(sensor)) |
AVERAGE_WEEK(MAX(sensor)) | MAX(AVERAGE_WEEK(SUM_SENSOR_LABELS(label))) |
AVERAGE_WEEK(SUM_SENSOR_LABELS(label)) | |
AVERAGE_WEEK(MAX(SUM_SENSOR_LABELS(label))) |
Note: This formula only returns results in the widgets of the "Monthly Evolution" group with daily or hourly aggregation. It can be used with the setting "Data Type = All" or "By sensor."
The AVERAGE_WEEK function is available on the following pages:
- Summary
- Reports (single site: shared and specific)
- Alerts
Calculation Principle
When calling an indicator configured with the AVERAGE_WEEK(XXX)
formula, here's what happens:
- The data from XXX is retrieved over a rolling year ending on the display period end date of the widget. For example, if you want to display the average week on a graph from 09/01/23 to 09/07/23, the data used is between 09/07/22 and 09/07/23. The average week's calculation depends on the display period!
- The retrieved data is sorted according to the interval they belong to. The interval duration corresponds to the chosen aggregation:
- If the widget is configured with hourly aggregation, all values of the same day of the week at a specific time are sorted. For example, the average of all values on Mondays at 10:00.
- If the widget is configured with daily aggregation, all values of the same day of the week are sorted. For example, the average of all values on Mondays.
- The average of the values sorted by interval is calculated.
- An entire week is reconstructed by joining the results for all intervals.
- If the widget's display period is longer than a week, the data is repeated as many times as necessary.