> ## Documentation Index
> Fetch the complete documentation index at: https://getlago.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Compare aggregation types and choose how Lago calculates usage from your events.

An aggregation type defines how a billable metric calculates a quantity from usage events. Choose it based on what you want to measure: the number of actions, distinct users, a total, or a reported value.

For example, use Count to count API calls, Sum to total tokens consumed, or Max to find the highest number of CPUs used.

| Aggregation | `aggregation_type` | What it does | Supports recurring: |
| - | - | - | - |
| [Count](https://getlago.com/docs/v2/guide/billable-metrics/aggregation-types/count.md) | `count_agg` | Counts matching events. | False |
| [Count unique](https://getlago.com/docs/v2/guide/billable-metrics/aggregation-types/count-unique.md) | `unique_count_agg` | Counts distinct values of an event property. | True |
| [Latest](https://getlago.com/docs/v2/guide/billable-metrics/aggregation-types/latest.md) | `latest_agg` | Uses the most recent value of an event property. | False |
| [Max](https://getlago.com/docs/v2/guide/billable-metrics/aggregation-types/max.md) | `max_agg` | Uses the highest value of an event property. | False |
| [Sum](https://getlago.com/docs/v2/guide/billable-metrics/aggregation-types/sum.md) | `sum_agg` | Adds the values of an event property. | True |
| [Weighted sum](https://getlago.com/docs/v2/guide/billable-metrics/aggregation-types/weighted-sum.md) | `weighted_sum_agg` | Weights each value by how long it applies during the billing period. | True |

`Count` measures how many matching events Lago receives. Other aggregation types use a value within each event. Set `field_name` to the property you want to measure—for example, `tokens` to add up token usage. You can also use [SQL expressions](https://getlago.com/docs/v2/guide/billable-metrics/sql-expressions.md) to calculate a value from event properties.

The `recurring` setting controls what happens to the measured quantity when a billing cycle ends:

* `true`: Lago keeps the quantity and carries it into the next billing cycle.
* `false`: Lago resets the quantity, so each billing cycle starts fresh.

> [card] [Aggregation examples](https://getlago.com/docs/v2/guide/billable-metrics/aggregation-types/aggregation-examples.md)
>
> Compare how aggregation types calculate usage.

> [card] [Metric recurrence](https://getlago.com/docs/v2/guide/billable-metrics/recurring-vs-metered.md)
>
> Choose whether aggregated values carry over or reset.

> [card] [Create billable metrics](https://getlago.com/docs/v2/guide/billable-metrics/create-billable-metrics.md)
>
> Define what to measure and how to calculate it.

> [card] [Billable metric object (API)](https://getlago.com/docs/v2/api-reference/billable-metrics/object.md)
>
> Explore the metric's fields.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.