Contact Free trial Login


avg(Array<Number>): Number

Returns the average of numeric values in a list (an array).

A list that is empty or that contains a non-numeric value results in an error.


This example returns the average of multiple arrays.


%dw 2.0
output application/json
  a: avg([1, 1000]),
  b: avg([1, 2, 3])


  "a": 500.5,
  "b": 2.0

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.