---
title: approx_percentile_rank() | Tiger Data Docs
description: Estimate the percentile of a given value from a `tdigest`
---

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

Estimate the percentile at which a given value would be located.

## Samples

Estimate the percentile rank of the value `99`, given a sample containing the numbers from 0 to 100.

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

```
approx_percentile_rank
----------------------------
        0.9851485148514851
```

## Arguments

The syntax is:

```
approx_percentile_rank(
  value DOUBLE PRECISION,
  digest TDigest
) RETURNS DOUBLE PRECISION
```

| Name   | Type             | Default | Required | Description                             |
| ------ | ---------------- | ------- | -------- | --------------------------------------- |
| value  | DOUBLE PRECISION | -       | ✔        | The value to estimate the percentile of |
| digest | TDigest          | -       | ✔        | The `tdigest` aggregate                 |

## Returns

| Column                   | Type             | Description                                                  |
| ------------------------ | ---------------- | ------------------------------------------------------------ |
| approx\_percentile\_rank | DOUBLE PRECISION | The estimated percentile associated with the provided value. |
