About
Function that selects the first/last returned value of the expression argument.
Syntax:
FIRST (expression)
LAST (expression)
where expression is any expression.
Articles Related
Limitations
You cannot use it in Logical SQL statements. It must be used in the repository.
Implementation
By default, the FIRST/LAST function operates at the most detailed level specified of all dimension.
For example, if you have:
- a time dimension defined with hierarchy levels year, month, day
- a geographic store dimension defined with hierarchy levels county, state, zip, store
the FIRST/LAST function returns the first/last value for the combination day/store on each level. (i.e. even if the report asks a month summary for instance).
To limit the FIRST/LAST function, you must define an dimension-specific aggregation rules in the repository.
Support
Bad Performance
You should not use the FIRST/LAST function as the first dimension-specific aggregate rule. It might cause queries to occurs on large numbers of rows.