> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> 使用线性插值，同时计算数值数据序列在不同级别上的多个分位数，并考虑每个元素的权重。

# quantilesExactWeightedInterpolated

<div id="quantilesExactWeightedInterpolated">
  ## quantilesExactWeightedInterpolated
</div>

首次引入版本：v24.10.0

考虑每个元素的权重，使用线性插值同时计算数值数据序列在不同级别上的多个[分位数](https://en.wikipedia.org/wiki/Quantile)。

此函数等同于 [`quantileExactWeightedInterpolated`](/docs/zh/reference/functions/aggregate-functions/quantileExactWeightedInterpolated)，但支持在一次遍历中计算多个分位数级别，因此比逐个调用分位数函数更高效。

**语法**

```sql theme={null}
quantilesExactWeightedInterpolated(level1, level2, ...)(expr, weight)
```

**参数**

* `level` — 分位数的级别。一个或多个介于 0 到 1 之间的常量浮点数。建议将 `level` 值设在 `[0.01, 0.99]` 范围内。[`Float*`](/docs/zh/reference/data-types/float)

**Arguments**

* `expr` — 基于列值的表达式，其结果为数值数据类型、`Date`、`DateTime` 或 `DateTime64`。[`(U)Int*`](/docs/zh/reference/data-types/int-uint) 或 [`Int128`](/docs/zh/reference/data-types/int-uint) 或 [`UInt128`](/docs/zh/reference/data-types/int-uint) 或 [`Int256`](/docs/zh/reference/data-types/int-uint) 或 [`UInt256`](/docs/zh/reference/data-types/int-uint) 或 [`Float*`](/docs/zh/reference/data-types/float) 或 [`Decimal*`](/docs/zh/reference/data-types/decimal) 或 [`Date`](/docs/zh/reference/data-types/date) 或 [`DateTime`](/docs/zh/reference/data-types/datetime) 或 [`DateTime64`](/docs/zh/reference/data-types/datetime64)
* `weight` — 包含序列成员权重的列。权重表示值出现的次数。[`UInt*`](/docs/zh/reference/data-types/int-uint)

**返回值**

按指定级别的顺序返回分位数组。数值参数会生成 `Float64`，而 `Decimal`、`Date`、`DateTime` 和 `DateTime64` 参数会保留其输入格式。[`Array(Float64)`](/docs/zh/reference/data-types/array) 或 [`Array(Decimal*)`](/docs/zh/reference/data-types/array) 或 [`Array(Date)`](/docs/zh/reference/data-types/array) 或 [`Array(DateTime)`](/docs/zh/reference/data-types/array) 或 [`Array(DateTime64)`](/docs/zh/reference/data-types/array)

**示例**

**计算多个精确加权插值分位数**

```sql title=Query theme={null}
SELECT quantilesExactWeightedInterpolated(0.25, 0.5, 0.75)(number, 1) FROM numbers(10)
```

```response title=Response theme={null}
┌─quantilesExactWeightedInterpolated(0.25, 0.5, 0.75)(number, 1)─┐
│ [2.25,4.5,6.75]                                                │
└────────────────────────────────────────────────────────────────┘
```
