MINIMUM( ) function

Returns the minimum value in a set of numeric values, or the oldest value in a set of datetime values.

Syntax

MINIMUM(value_1, value_2 <,...n>)

Parameters

Name Type Description
value_1, value_2<, ...n>

numeric

datetime

The values to compare, separated by commas.

All values must be of the same data type.

Additionally, datetime values must be of the same subtype. You cannot mix date, datetime, or time values in a single execution of the function.

Output

Numeric or Datetime.

Examples

Basic examples

Literal numeric input

Returns 4:

MINIMUM(4, 7)

Returns 3:

MINIMUM(4, 7, 3, 8)

Returns 3.00:

MINIMUM(4, 7.25, 3, 8)

Literal datetime input

Returns `20161229`:

MINIMUM(`20161231`, `20161229`, `20161230`)

Returns `20161229 23:59:59`:

MINIMUM(`20161231 235959`, `20161229 235959`)

Returns `23:59:57`:

MINIMUM(`.235957`, `.235959`, `.235958`)

Field input

Returns the oldest date among the three fields for each record:

MINIMUM(PO_Date, Invoice_Date, Payment_Date)

Advanced examples

Identifying the lowest value among multiple fields

Create a computed field to identify the lowest value among the Cost, Sale_Price, and Discount_Price fields:

DEFINE FIELD Low_Value COMPUTED MINIMUM(Cost, Sale_Price, Discount_Price)

Discovering dates before the beginning of a quarter

To discover if any dates across multiple fields are before the beginning of a quarter, create a computed field with an expression like the one below:

DEFINE FIELD Pre_Qtr COMPUTED MINIMUM(PO_Date, Invoice_Date, Payment_Date, `20160101`)
  • Records with all dates on or after 01 Jan 2016 return `20160101`.
  • Records with one or more dates before 01 Jan 2016 return the oldest date among the three fields.

Remarks

How decimal places work in sets of numeric values

If the numeric values being compared do not have the same number of decimal places, the result is adjusted to the largest number of decimal places.

Returns 3.600:

MINIMUM(3.6,10.88, 20.482)

You can use the DECIMALS( ) function to adjust the number of decimals for value parameters.

Returns 3.60:

MINIMUM(3.6,10.88, DECIMALS(20.482, 2))

The MIN( ) abbreviation

In ACLScript, you can use the abbreviation MIN( ) for the MINIMUM( ) function even though it does not uniquely identify the function, which is the normal requirement when abbreviating function names.

MIN( ) could also be an abbreviation for MINUTE( ), however Analytics reserves the abbreviation MIN( ) for the MINIMUM( ) function.