WEIGHTED_AVERAGE
The weighted average of a value in the time window. The more current the time the higher the weight.
Syntax
WEIGHTED_AVERAGE(VALUE, WEIGHT)
Arguments
VALUE:
The field to average.
WEIGHT:
The field giving weight.
Returns
The result matches the type of value.
Notes
In the example below, cpuUsage
is multiplied by time
to give a Weighted Total.
The Weighted Total is then divided by the sum of the times
to give a Weighted Average.
In Athena output, WEIGHTED_AVERAGE data can be BIGINT or NUMBER type.
In Upsolver output, WEIGHTED_AVERAGE data can be NUMBER type only.
Example
Data
Query
Find the weighted average cpu usage, giving weight to the time the data was received:
Results
Related Functions
Dialog
Last updated