| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | [discrete][[esql-agg-avg]]=== `AVG`*Syntax*[source,esql]----AVG(expression)----`expression`::Numeric expression.//If `null`, the function returns `null`.// TODO: Remove comment when https://github.com/elastic/elasticsearch/issues/104900 is fixed.*Description*The average of a numeric expression.*Supported types*The result is always a `double` no matter the input type.*Examples*[source.merge.styled,esql]----include::{esql-specs}/stats.csv-spec[tag=avg]----[%header.monospaced.styled,format=dsv,separator=|]|===include::{esql-specs}/stats.csv-spec[tag=avg-result]|===The expression can use inline functions. For example, to calculate the averageover a multivalued column, first use `MV_AVG` to average the multiple values perrow, and use the result with the `AVG` function:[source.merge.styled,esql]----include::{esql-specs}/stats.csv-spec[tag=docsStatsAvgNestedExpression]----[%header.monospaced.styled,format=dsv,separator=|]|===include::{esql-specs}/stats.csv-spec[tag=docsStatsAvgNestedExpression-result]|===
 |