MAX
MAX('Node1', 'Node2')
The MAX function returns the maximum 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 maximum of two nodes or when you want to apply a lower threshold (floor) to a node: MAX('Revenue', 0).
Parameters
- Node1Node reference or numberRequired
- First input, specified using the node name in single quotes (e.g.
'Revenue') or a number - Node2Node reference or numberRequired
- Second input, specified using the node name in single quotes (e.g.
'Threshold') or a number
Output shape
- 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 higher 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, MAX 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 maximum across two inputs
This example shows MAX 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: MAX('A', 'B')
| Year | MAX Result |
|---|---|
| 2025 | 41 |
| 2026 | 12 |
| 2027 | -17 |
Formula: MAX('A', 7)
| Year | MAX Result |
|---|---|
| 2025 | 32 |
| 2026 | 7 |
| 2027 | 7 |
Using MAX as a floor (clamp negative values to zero)
A common pattern: use MAX('Node', 0) to ensure no negative values appear in the result.
Input node: 'Margin'
| Year | Value |
|---|---|
| 2025 | 15 |
| 2026 | -8 |
| 2027 | 22 |
| 2028 | -3 |
Formula: MAX('Margin', 0)
| Year | MAX Result |
|---|---|
| 2025 | 15 |
| 2026 | 0 |
| 2027 | 22 |
| 2028 | 0 |
Negative margins are replaced with 0. Positive margins are kept as-is.