MIN
- MIN(*values)[source]
Returns the minimum 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:
- Returns:
The minimum 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
Minimum of numeric literals:
MIN(3, 7, 1, 9) # Returns 1
Minimum of multiple table columns:
MIN(order_table["quantity"], order_table["min_quantity"]) # Returns the smallest value between both columns
Minimum of date values:
MIN(DATE(2025, 1, 1), DATE(2024, 12, 31)) # Returns DATE(2024, 12, 31)
Note
This formula only returns a scalar value. For array-wise minimums, use the ARRAYMIN formula instead.