| 1234567891011121314151617181920212223242526272829303132333435363738394041 | [discrete][[esql-agg-sum]]=== `SUM`*Syntax*[source,esql]----SUM(expression)----`expression`::Numeric expression.*Description*Returns the sum of a numeric expression.*Example*[source.merge.styled,esql]----include::{esql-specs}/stats.csv-spec[tag=sum]----[%header.monospaced.styled,format=dsv,separator=|]|===include::{esql-specs}/stats.csv-spec[tag=sum-result]|===The expression can use inline functions. For example, to calculatethe sum of each employee's maximum salary changes, apply the`MV_MAX` function to each row and then sum the results:[source.merge.styled,esql]----include::{esql-specs}/stats.csv-spec[tag=docsStatsSumNestedExpression]----[%header.monospaced.styled,format=dsv,separator=|]|===include::{esql-specs}/stats.csv-spec[tag=docsStatsSumNestedExpression-result]|===
 |