# MIN
URL: https://docs.valsight.ai/min/
Description: The MIN function returns the minimum of matching values from two inputs. Both inputs must have either the same dimensionality or one input must be a number, in which case the result has the dimensionality of the other input.
**Category:** [Math & numeric](/math-numeric/)

## Overview

The **MIN** function **returns the minimum of matching values from two inputs**. Both inputs must have either the same dimensionality or one input must be a number, in which case the result has the dimensionality of the other input.

Use this function when you need the row-wise minimum of two nodes or when you want to apply an upper threshold (cap) to a node.

## Syntax

`MIN('Node1', 'Node2')`

**Example usage:** `MIN('Revenue', 1000)`

## Parameters

| Parameter | Description                                                                                  | Type                     | Required |
| --------- | -------------------------------------------------------------------------------------------- | ------------------------ | -------- |
| **Node1** | First input, specified using the node name in single quotes (e.g.`'Revenue'`) or a number    | Node reference or number | Yes      |
| **Node2** | Second input, specified using the node name in single quotes (e.g.`'Threshold'`) or a number | Node reference or number | Yes      |

## Output shape

| Aspect         | Behavior                                                                                                                  |
| -------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Dimensionality | Same as the input with levels. If one input is a constant (number), the result has the dimensionality of the other input. |
| Values         | For each matching row, the lower of the two values is returned.                                                           |
| Row count      | Same as input.                                                                                                            |

## Watch out

* If both inputs have levels, they **must have the same dimensionality**. Unlike multiplication or division, MIN does not perform dimension union or intersection.
* One input can be a **constant number** (e.g. `0`, `100`). In that case, the constant is compared against every row of the other input.

## Examples

### Row-wise minimum across two inputs

This example shows MIN applied both to two input nodes and to a node combined with a fixed numeric threshold.

**Input node:** `'A'`

| Year | Value |
| ---- | ----- |
| 2025 | 32    |
| 2026 | -42   |
| 2027 | -17   |

**Input node:** `'B'`

| Year | Value |
| ---- | ----- |
| 2025 | 41    |
| 2026 | 12    |
| 2027 | -25   |

**Formula:** `MIN('A', 'B')`

| Year | MIN Result |
| ---- | ---------- |
| 2025 | 32         |
| 2026 | -42        |
| 2027 | -25        |

**Formula:** `MIN('A', 12)`

| Year | MIN Result |
| ---- | ---------- |
| 2025 | 12         |
| 2026 | -42        |
| 2027 | -17        |

### Using MIN as a cap (clamp values to an upper limit)

A common pattern: use `MIN('Node', threshold)` to ensure no value exceeds a defined maximum.

**Input node:** `'Discount Rate'`

| Year | Value |
| ---- | ----- |
| 2025 | 0.05  |
| 2026 | 0.12  |
| 2027 | 0.08  |
| 2028 | 0.25  |

**Formula:** `MIN('Discount Rate', 0.15)`

| Year | MIN Result |
| ---- | ---------- |
| 2025 | 0.05       |
| 2026 | 0.12       |
| 2027 | 0.08       |
| 2028 | 0.15       |

Values above 15% are capped at 0.15. Values already below the threshold are kept as-is.

## Related

| Function     | When to use instead                                                                    |
| ------------ | -------------------------------------------------------------------------------------- |
| [MAX](/max/) | When you need the row-wise maximum of two nodes or thresholds instead of the minimum.  |
| [ABS](/abs/) | When you need absolute values of one node rather than a comparison between two inputs. |
