Function Reference > Functions > MAX (Dates)
  

MAX (Dates)

Returns the latest date found within a field or group. You can apply a filter to limit the rows in the search. You can also use MAX to return the largest numeric value or the highest string value in a field or group.
You can nest only one other aggregate function within MAX. You cannot nest aggregate functions in advanced mode.
Use only in mapping tasks.

Syntax

MAX( date [, filter_condition] )
Argument
Required/
Optional
Description
date
Required
Date/time data type. Passes the date for which you want to return a maximum date. You can enter any valid transformation expression.
filter_condition
Optional
Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value

Date.
NULL if all values passed to the function are NULL, or if no rows are selected (for example, the filter condition evaluates to FALSE or NULL for all rows).

Example

You can return the maximum date for a field or group. The following expression returns the maximum order date for flashlights:
MAX( ORDERDATE, ITEM_NAME='Flashlight' )
ITEM_NAME
ORDER_DATE
Flashlight
Apr 20 1998
Regulator System
May 15 1998
Flashlight
Sep 21 1998
Diving Hood
Aug 18 1998
Flashlight
NULL
RETURN VALUE: Sep 21 1998