Aggregation types
SUM
The sum aggregation type adds up the value of a defined event property.

SUM calculation method
SUM billable metric
Dashboard
API
Here is how you can create a sum 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 “sum” as the aggregation type;
- Define it this metric is
metered
orrecurring
; - Define the property to aggregate;
- Apply dimension groups if any; and
- Click “Add billable metric”.
This billable metric can be both metered
or recurring
.
Calculation example
Lago calculates the SUM(events.properties.property_name)
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 adds up the values of the total_requests
property in the event payloads, resulting in a billable value of 30 units.
Was this page helpful?