# arraySum

Calculates the sum of all the values in an array.

The arraySum function returns the sum of numeric values in a collection or array. This function operates on a single array value, ignoring null and missing values.

To calculate the sum across multiple rows in an iterative context, use the sum function instead.

## Arguments

Array of numeric values.

## Examples

Calculate the sum of prices stored in an array:

```
WITH $prices = ( FROM product SELECT price )
SELECT arraySum($prices)
```

Calculate the total of values in an array field:

```
FROM daily_sales
SELECT {
  date,
  total_sales = arraySum(sales_amounts)
}
```

## Related functions

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