---
title: total() | Tiger Data Docs
description: Calculate the exact sum of the values in a `tdigest`
---

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

Calculate the exact sum of all the values added to a `tdigest` aggregate. Unlike percentile calculations, the sum is exact, though there might be some loss of precision. This accessor allows you to calculate the total alongside percentiles, without needing to create two separate aggregates from the same raw data.

## Samples

Calculate the sum of the integers from 0 to 100.

```
SELECT total(tdigest(100, data))
FROM generate_series(0, 100) data;
```

```
total
-------
5050
```

## Arguments

The syntax is:

```
total(
  digest TDigest
) RETURNS DOUBLE PRECISION
```

| Name   | Type    | Default | Required | Description                                     |
| ------ | ------- | ------- | -------- | ----------------------------------------------- |
| digest | TDigest | -       | ✔        | The `tdigest` aggregate to extract the sum from |

## Returns

| Column | Type             | Description                             |
| ------ | ---------------- | --------------------------------------- |
| total  | DOUBLE PRECISION | The sum of the values in the `tdigest`. |
