Built-in Functions → firstVersion

firstVersion() is a filter function that returns the first occurrence of a value with respect to date (i.e. the order-by parameter). Unless used as a filter, this function must be used inside an aggregation function.

Signature

firstVersion(<type> value, <type> group_by, date order_by)
  • value : an Incorta type
  • group_by : an Incorta type
  • order_by : date

Returns

Type of value

Example

Sum the first AMOUNT_SOLD value relative to TIME_ID grouped by CUSTOMER_ID.

sum(firstVersion(SALES.SALES.AMOUNT_SOLD, SALES.SALES.CUSTOMER_ID, SALES.SALES.TIME_ID))