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

# Subtract

# \$subtract

The `$subtract` operator subtracts the second numeric value from the first numeric value.

## Input

* An array containing exactly two numeric values (minuend and subtrahend)

## Output

* The difference of the two input values (first - second)

## Examples

### Basic Subtraction

```json theme={null}
{
  "$subtract": [
    10,
    3
  ]
}
```

Result: `7`

### Field Value Subtraction

```json theme={null}
{
  "$subtract": [
    {
      "$input": "revenue"
    },
    {
      "$input": "expenses"
    }
  ]
}
```

Result: The difference between revenue and expenses fields

### Decimal Subtraction

```json theme={null}
{
  "$subtract": [
    15.5,
    5.2
  ]
}
```

Result: `10.3`
