## Overview 

Aggregations power your metrics. Since you've decided what data you want with a filter, how often to calculate it with an interval and how to slice it with groupings -- now it's time to actually decide what to aggregate. 

!!! info
You can have an 10 aggregations per filter.
!!!

Each aggregation has four components:

Component | Description
--- | ---
Filter Name | Name to describe the aggregation
Sub Filter | Jpath filter to further narrow your aggregation. Similar to filter, sub-filter is defined using JPath. For more details, see [JPath](/jpath#filters)
Calculations | The computation(s) to perform
Field | The property on your events to perform the calculation on. If your only calculation is `Count`, a Field is not necessary.

---

## Calculations

Calculations are the statistical computations you want to run to achieve your metrics. Each aggregation can have any combination of calculations.

Aggregations.io supports the following Calculations:

Calculation | Description
--- | --- | ---
Min (Minimum) | the smallest value in the field defined 
Max (Maximum) | the largest value in the field defined 
Avg (Average) | the average value for the field defined
Sum | Summation of all non-null numerical values in the field 
Count | A count of events matching the filter & (optional) sub-filter. No field needs to be defined if `Count` is the only calculation.
Approx Distinct Count | An estimated count of unique values in the field defined. Computed using an adaptive sample with a maximum ~2% margin of error (although typically much lower)
Percentile | Percentile distribution for the field defined. You can define the percentile value desired at retrieval time. Percentiles are calculated by maintaing a [t-digest](https://github.com/tdunning/t-digest/blob/main/docs/t-digest-paper/histo.pdf){target="_blank"} state.

#### Non Numeric Fields

If a field defined is found to contain a non-numerical value or not exist on a given payload - it will not be used for the calculation.

For example, if the aggregation is defined as `Sum, Count, Avg` for `@.num` and the following events are sent:

```json
[
    {"num":2},
    {"num":4},
    {"num":0},
    {"num":"apples"}
]
```

- The `Sum` will be `6`
- The `Avg` will be `2`
- The `Count` will be `4`

!!!
Need a different calculation? [Contact Us](https://aggregations.io/contact?subject=New%20Calculation%20Request)
!!!
