# sum

Computes the sum of all values.

```tql
sum(xs:list) -> int
```

## Description

The `sum` function computes the total of all number values.

### `xs: list`

The values to aggregate.

## Examples

### Compute a sum over a group of events

```tql
from {x: 1}, {x: 2}, {x: 3}
summarize n=sum(x)
```

```tql
{n: 6}
```

## See Also

* [`collect`](https://preview.docs.tenzir.com/375/375/reference/functions/collect.md)
* [`max`](https://preview.docs.tenzir.com/375/375/reference/functions/max.md)
* [`mean`](https://preview.docs.tenzir.com/375/375/reference/functions/mean.md)
* [`min`](https://preview.docs.tenzir.com/375/375/reference/functions/min.md)
* [Aggregate event streams](https://preview.docs.tenzir.com/375/375/guides/analytics/aggregate-event-streams.md)
* [Plot data with charts](https://preview.docs.tenzir.com/375/375/tutorials/plot-data-with-charts.md)
* [Learn idiomatic TQL](https://preview.docs.tenzir.com/375/375/tutorials/learn-idiomatic-tql.md)