# Find percentile and quantile values

Use the `quantile()` function to return a value representing the `q` quantile or percentile of input data.

## Percentile versus quantile

Percentiles and quantiles are very similar, differing only in the number used to calculate return values. A percentile is calculated using numbers between `0` and `100`. A quantile is calculated using numbers between `0.0` and `1.0`. For example, the `0.5` quantile is the same as the 50th percentile.

## Select a method for calculating the quantile

Select one of the following methods to calculate the quantile:

### estimate_tdigest

(Default) An aggregate method that uses a t-digest data structure to compute a quantile estimate on large data sources. Output tables consist of a single row containing the calculated quantile.

If calculating the `0.5` quantile or 50th percentile:

Given the following input table:

_time_value
2020-01-01T00:01:00Z1.0
2020-01-01T00:02:00Z1.0
2020-01-01T00:03:00Z2.0
2020-01-01T00:04:00Z3.0

`estimate_tdigest` returns:

_value
1.5

### exact_mean

An aggregate method that takes the average of the two points closest to the quantile value. Output tables consist of a single row containing the calculated quantile.

If calculating the `0.5` quantile or 50th percentile:

Given the following input table:

_time_value
2020-01-01T00:01:00Z1.0
2020-01-01T00:02:00Z1.0
2020-01-01T00:03:00Z2.0
2020-01-01T00:04:00Z3.0

`exact_mean` returns:

_value
1.5

### exact_selector

A selector method that returns the data point for which at least `q` points are less than. Output tables consist of a single row containing the calculated quantile.

If calculating the `0.5` quantile or 50th percentile:

Given the following input table:

_time_value
2020-01-01T00:01:00Z1.0
2020-01-01T00:02:00Z1.0
2020-01-01T00:03:00Z2.0
2020-01-01T00:04:00Z3.0

`exact_selector` returns:

_time_value
2020-01-01T00:02:00Z1.0

The examples below use the example data variable.

## Find the value representing the 99th percentile

Use the default method, `"estimate_tdigest"`, to return all rows in a table that contain values in the 99th percentile of data in the table.

``````data
|> quantile(q: 0.99)
``````

## Find the average of values closest to the quantile

Use the `exact_mean` method to return a single row per input table containing the average of the two values closest to the mathematical quantile of data in the table. For example, to calculate the `0.99` quantile:

``````data
|> quantile(q: 0.99, method: "exact_mean")
``````

## Find the point with the quantile value

Use the `exact_selector` method to return a single row per input table containing the value that `q * 100`% of values in the table are less than. For example, to calculate the `0.99` quantile:

``````data
|> quantile(q: 0.99, method: "exact_selector")
``````

## Use quantile() with aggregateWindow()

`aggregateWindow()` segments data into windows of time, aggregates data in each window into a single point, and then removes the time-based segmentation. It is primarily used to downsample data.

To specify the quantile calculation method in `aggregateWindow()`, use the full function syntax:

``````data
|> aggregateWindow(
every: 5m,
fn: (tables=<-, column) => tables
|> quantile(q: 0.99, method: "exact_selector"),
)
``````

### Introducing InfluxDB Clustered

A highly available InfluxDB 3.0 cluster on your own infrastructure.

InfluxDB Clustered is a highly available InfluxDB 3.0 cluster built for high write and query workloads on your own infrastructure.

InfluxDB Clustered is currently in limited availability and is only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

### The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following:

### State of the InfluxDB Cloud Serverless documentation

InfluxDB Cloud Serverless documentation is a work in progress.

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.