RANGE_AVERAGE

Compute the average for a given property within a time window defined by a start date and an end date.

Usage

RANGE_AVERAGE(eventListName, propertyName, startDate, endDate)

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.

startDate

DateTimeString

The date and time we should start computing the average from.

endDate

DateTimeString

The date and time we should stop computing the average to.

Returns

Number

Examples

RANGE_AVERAGE(‘MyColl’, ‘Temp’, ‘2021-03-04’, ‘2021-03-15’)

Average of Temp for events in MyColl fired between 3/4/21 and 3/15/21.

RANGE_AVERAGE(‘MyColl’, ‘Temp’, ‘2021-03-04’, GET_CURRENT_TIME())

Average of Temp values for events in MyColl fired between 3/4/21 and now.

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.