avg()

Calculates the average of all expressions that belong to the group. It eliminates expression pairs where either expression in the pair is NULL or not numeric.

Syntax

avg(EXPR)
Required parameter
EXPR
Numeric expression

Usage

# Create 2 fields with 100 random records with numbers in the range of 1 to 100 and calculate the average.
| json "{}" 
| repeat count=100 | eval n1=rand(101), n2=rand(101) 
| stats avg(n1) as n1_avg, avg(n2) as n2_avg