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

# Median

# \$median

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

## Input

* An array of numeric values to find the median of (at least one value required)

## Output

* The median of all input values

## Examples

### Median of Odd Number of Values

```json theme={null}
{
  "$median": [
    1,
    3,
    3,
    6,
    7,
    8,
    9
  ]
}
```

Result: `6`

### Median of Even Number of Values

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

Result: `2.5`

### Median of Field Values

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

Result: The median of value1, value2, value3, and value4 fields
