Skip to main content

selectMaxDate

Returns the max value (Date, Timestamp, or Datetime) from the specified table column.

This function serves as a manual substitute for the Now() and CurrentTimestamp() functions. It provides a way to manually control the dynamic expression key member by inserting or updating the table at the end of a periodic ETL batch job. In this way, you can have explicit control over the high-water mark used in the model without relying on the point-in-time return value of Now() or CurrentTimestamp().

This function can be used to avoid exposing users to partially populated sets of tables. Additionally, it may be useful for models that rely on non-Gregorian values of Now(), as these models cannot use the Now() function to identify the current non-Gregorian Date key.

Syntax

selectMaxDate("Table", "Column")

Parameters

Table
The table that contains the Column you want to return the max date for.

Column
The specific column within the Table to return the max date for.

Examples

The following expression returns the maximum date value from the data_load_complete_date column of the myschema.etl_high_watermark table:

[Order Date Dimension].[Order Date Month Hierarchy].[Day].&[`selectMaxDate("myschema.etl_high_watermark", "data_load_complete_date")`]