arrayAvg
Calculates the average value of an array.
The arrayAvg function returns the average of numeric values in a collection or array. This function operates on a single array value, ignoring null and missing values.
To calculate the average across multiple rows in an iterative context, use the avg function instead.
Arguments
Array of numeric values.
Examples
Calculate the average of ratings stored in an array:
WITH $ratings = ( FROM customer SELECT rating )
SELECT arrayAvg($ratings)Calculate the average of scores in an array field:
FROM test_results
SELECT {
student_id,
average_score = arrayAvg(scores)
}