---
title: stats_agg() (one variable) | Tiger Data Docs
description: Aggregate data into an intermediate statistical aggregate form for further calculation
---

Since [1.3.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/1.3.0)

Aggregate data into an intermediate statistical aggregate form for further calculation. This is the first step for performing any statistical aggregate calculations on one-dimensional data. Use `stats_agg` to create an intermediate aggregate (`StatsSummary1D`) from your data. This intermediate form can then be used by one or more accessors in this group to compute final results. Optionally, multiple such intermediate aggregate objects can be combined using `rollup()` or `rolling()` before an accessor is applied.

`stats_agg` is well suited for creating a continuous aggregate that can serve multiple purposes later. For example, you can create a continuous aggregate using `stats_agg` to calculate average and sum. Later, you can reuse the same `StatsSummary1D` objects to calculate standard deviation from the same continuous aggregate.

## Arguments

The syntax is:

```
stats_agg(
    value DOUBLE PRECISION
) RETURNS StatsSummary1D
```

| Name  | Type             | Default | Required | Description                                       |
| ----- | ---------------- | ------- | -------- | ------------------------------------------------- |
| value | DOUBLE PRECISION | -       | ✔        | The variable to use for the statistical aggregate |

## Returns

| Column     | Type           | Description                                                                                                                                                                                                                                                                                                    |
| ---------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| stats\_agg | StatsSummary1D | The statistical aggregate, containing data about the variables in an intermediate form. Pass the aggregate to accessor functions in the statistical aggregates API to perform final calculations. Or, pass the aggregate to rollup functions to combine multiple statistical aggregates into larger aggregates |
