# 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)
}
```

## Related functions

* [avg](https://help.qlik.com/talend/en-US/data-shaping-language-reference-guide/8.0/avg-function) - Calculates the average in an iterative context
* [arraySum](https://help.qlik.com/talend/en-US/data-shaping-language-reference-guide/8.0/arraysum-function) - Calculates the sum of values in an array