MAX

MAX(*values)[source]

Returns the maximum value among the provided inputs.

This function evaluates the given inputs, which can be numeric literals, fields, formulas, calculations, or parameters, and returns the smallest value. It supports scalar and array-compatible numeric, date, time, and datetime types.

Parameters:

*values (Operand | int | float) –

An arbitrary number of values or fields to compare. All inputs must be of compatible types (numeric, date, time, or datetime).

Supported types:

  • INTEGER

  • DECIMAL

  • DATE

  • DATETIME

  • TIME

  • INTEGER_ARRAY

  • DECIMAL_ARRAY

  • DATE_ARRAY

  • DATETIME_ARRAY

  • TIME_ARRAY

Return type:

Formula

Returns:

The maximum value among the inputs.

Supported types:

  • INTEGER

  • DECIMAL

  • DATE

  • DATETIME

  • TIME

Raises:
  • ValueError – If no inputs are provided.

  • ValueError – If any input is of an unsupported type.

  • ValueError – If inputs are of incompatible types.

Examples

Maximum of numeric literals:

MAX(3, 7, 1, 9)
# Returns 9

Maximum of multiple table columns:

MAX(order_table["quantity"], order_table["min_quantity"])
# Returns the largest value between both columns

Maximum of date values:

MAX(DATE(2025, 1, 1), DATE(2024, 12, 31))
# Returns DATE(2025, 1, 1)

Note

This formula only returns a scalar value. For array-wise maximums, use the ARRAYMAX formula instead.