MedianRunOverTime

This function returns the median value in the set of values whose timestamps are greater than the newest timestamp minus the specified interval.

Syntax

MedianRunOverTime ( number, valueTimestamp, interval)

Remarks

The number parameter specifies the data value for which the median is to be calculated. The valueTimestamp is the timestamp for this data value. (The Timestamp function can be used to obtain this timestamp.) The interval parameter is the time interval, in nanoseconds, over which to calculate the median. The predefined time constants can be used to easily input the number of nanoseconds in a microsecond (nsecPerUSec), millisecond (nsecPerMSec), second (nsecPerSec), minute (nsecPerMin), hour (nsecPerHour), day (nsecPerDay), or week (nsecPerWeek). The function will buffer any values whose time is within the specified interval. Any value that evaluates to –INF, INF, or NAN will be ignored. If there are no valid values to consider, this function will return NAN.

Example

The following example will return the median of the variable Temp_F over the past 30 seconds. (The StartRelativeToNewest function backfills the data set initially to the full 30 second interval, provided that the data is available in the data source.)

StartRelativeToNewest(30*nsecPerSec, OrderCollected); MedianRunOverTime("Server:CR1000.Test.Count",Timestamp("Server:CR1000.Test.Count"),30*nsecPerSec)