> ## 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.

# Avg

# \$avg

The `$avg` operator returns the average (mean) of all numeric input values.

## Input

* An array of numeric values to average (at least one value required)

## Output

* The average of all input values

## Examples

### Average of Multiple Values

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

Result: `2.5`

### Average of Field Values

```json theme={null}
{
  "$avg": [
    {
      "$input": "score1"
    },
    {
      "$input": "score2"
    },
    {
      "$input": "score3"
    }
  ]
}
```

Result: The average of score1, score2, and score3 fields

### Single Value

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

Result: `5`
