Aggregation types
LATEST
The latest aggregation type selects the most recent value of a specified event property from all received events.

LATEST calculation method
LATEST billable metric
Dashboard
API
Here is how you can create a max aggregation from the UI:
- Access the “Billable metrics” section via the side menu;
- Create a new billable metric;
- Define a name, a code and an optional description;
- Select “latest” as the aggregation type;
- Define the property to aggregate;
- Apply dimension groups if any; and
- Click “Add billable metric”.
This billable metric is metered
only, meaning it cannot be recurring, and the number of billing units resets to 0 at the end of each period.
Calculation example
Lago calculates the LAST_VALUE(events.properties.property_name) OVER ([PARTITION BY events.timestamp])
for the two following events received.
//Event received #1
{
"transaction_id": "transaction_1",
"external_customer_id": "1",
"timestamp": "2022-03-16T00:00:00Z",
"code": "api_requests",
"properties": {
"total_requests": 20
}
}
//Event received #2
{
"transaction_id": "transaction_2",
"external_customer_id": "1",
"timestamp": "2022-03-17T00:00:00Z",
"code": "api_requests",
"properties": {
"total_requests": 10
}
}
In that case, with this aggregation type, Lago takes the latest value of total_requests
property from all events, resulting in a billable value of 10 units.
Was this page helpful?