> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Exactly computes the quantile of a numeric data sequence.

# quantileExactInclusive

<h2 id="quantileExactInclusive">
  quantileExactInclusive
</h2>

Introduced in: v20.1.0

Similar to [`quantileExact`](/reference/functions/aggregate-functions/quantileExact), this computes the exact [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence.

This function is equivalent to [`quantileExact`](/reference/functions/aggregate-functions/quantileExact) but uses the inclusive method for calculating quantiles, as described in the [R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample).

When using this function, the quantile is calculated such that the interpolation formula for a given quantile p takes the form: `x[floor((n-1)*p)] + ((n-1)*p - floor((n-1)*p)) * (x[floor((n-1)*p)+1] - x[floor((n-1)*p)])`, where x is the sorted array.

To get the exact value, all the passed values are combined into an array, which is then fully sorted.
The sorting algorithm's complexity is `O(N·log(N))`, where `N = std::distance(first, last)` comparisons.

When using multiple `quantile*` functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could).
In this case, use the [quantiles](/reference/functions/aggregate-functions/quantiles) function.

**Syntax**

```sql theme={null}
quantileExactInclusive(level)(expr)
```

**Parameters**

* `level` — Level of quantile. Constant floating-point number from 0 to 1 (inclusive). We recommend using a `level` value in the range of `[0.01, 0.99]`. [`Float*`](/reference/data-types/float)

**Arguments**

* `expr` — Expression over the column values resulting in numeric data types, Date or DateTime. [`(U)Int*`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float) or [`Decimal*`](/reference/data-types/decimal) or [`Date`](/reference/data-types/date) or [`DateTime`](/reference/data-types/datetime)

**Returned value**

Returns the quantile of the specified level. [`Float64`](/reference/data-types/float)

**Examples**

**Computing exact inclusive quantile**

```sql title=Query theme={null}
SELECT quantileExactInclusive(0.25)(number) FROM numbers(5);
```

```response title=Response theme={null}
┌─quantileExactInclusive(0.25)(number)─┐
│                                    1 │
└──────────────────────────────────────┘
```

**Computing multiple quantile levels**

```sql title=Query theme={null}
SELECT quantileExactInclusive(0.1)(number), quantileExactInclusive(0.9)(number) FROM numbers(10);
```

```response title=Response theme={null}
┌─quantileExactInclusive(0.1)(number)─┬─quantileExactInclusive(0.9)(number)─┐
│                                 0.9 │                                 8.1 │
└─────────────────────────────────────┴─────────────────────────────────────┘
```
