> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sum

# \$sum

The `$sum` operator returns the sum of all numeric input values.

## Input

* An array of numeric values to sum

## Output

* The sum of all input values (returns 0 if no values provided)

## Examples

### Sum of Multiple Values

```json theme={null}
{
  "$sum": [
    1,
    2,
    3,
    4
  ]
}
```

Result: `10`

### Sum of Field Values

```json theme={null}
{
  "$sum": [
    {
      "$input": "value1"
    },
    {
      "$input": "value2"
    },
    {
      "$input": "value3"
    }
  ]
}
```

Result: The sum of value1, value2, and value3 fields

### No Values

```json theme={null}
{
  "$sum": []
}
```

Result: `0`
