LAST_AVERAGE
Compute the average for a given property within a time window between now and a date in the past determined by the provided duration.
Usage
LAST_AVERAGE(eventListName, propertyName, duration)
Parameters
eventListName |
String |
The name of the event list containing the events to use. |
propertyName |
String |
The name of the property to get an average for. It needs to be a number property. |
duration |
String |
A string representing a duration (expressed in the ISO 8601 format) to determine when to stop the average. |
Returns
Number
Examples
LAST_AVERAGE(‘MyColl’, ‘Temp’, ‘P7D’) |
Average of Temp for events in MyColl fired in the past 7 days. |
LAST_AVERAGE(‘MyColl’, ‘Temp’, ‘GETDURATIONFROMSEC(60)’) |
Average of Temp for events in MyColl fired in the past 60 seconds. |
LAST_AVERAGE(‘MyColl’, ‘Temp’, ‘PT1H’) |
Average of Temp for events in MyColl fired in the past hour. |
Remarks
If the provided collection name does not exist, or if no events were fired in the provided time window, the function will return 0.