Avg¶
Returns the mean of the given parameters or inputs, folding ARRAY inputs element-by-element.
Without parameters, Avg averages every available input. When parameters
are given, it averages only those parameters/fields. An ARRAY input is
folded element-by-element (the same way Min/Max/Sum/Count fold
arrays), so GetCDMTableId(@idx, :key)[] => Avg() returns the mean of all
matched values.
NULL values and NULL ARRAY elements are skipped — the mean is
sum(present values) / count(present values), mirroring SQL AVG(expr).
The result is always FLOAT. When there are no present (non-NULL) values
the result is NULL (no division by zero).
Avg accepts only numeric (INT/FLOAT) values; dates and strings are
rejected at setup.
Parameters¶
- N —
valuesOptional — accepts: field, FLOAT, INT -
The Nth value to average. May be a field reference (scalar or ARRAY) or a static number.
Input type¶
FLOATINTARRAY
Output type¶
FLOAT
Examples¶
Average across all inputs
Mean of a collected ARRAY