## AVG

The `AVG` function in ES|QL calculates the average of a numeric expression. The result is always a double, regardless of the input type.

### Examples

Here are a couple of examples of how you can use the `AVG` function in ES|QL queries:

1. Calculating the average height of employees:

    ```esql
FROM employees
| STATS AVG(height)
```

2. Calculating the average salary change, where the salary change is a multivalued column. In this case, the `MV_AVG` function is used to first average the multiple values per row, and then the `AVG` function is used on the result:

    ```esql
FROM employees
| STATS avg_salary_change = ROUND(AVG(MV_AVG(salary_change)), 10)
```