# sum

Source: https://zotonic.com/docs/2492/sum

URI: https://zotonic.com/id/2492

Language: en



Sum a list of numbers.

This filter calculates the sum of all numeric values in a list. Non-numeric values are automatically filtered out.

For example:

```django
    {{ [1, 2, 3, 4, 5] | sum }}
```

Results in `15`.

When applied to a list with mixed types:

```django
    {{ [10, 20, "text", 30] | sum }}
```

Results in `60`. The string "text" is ignored.

If the input is `undefined`, the filter returns `undefined`.

This filter is useful for analytics and reporting, such as summing values extracted from lists of maps or resources.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2492?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2492?language=en>)
