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

> 返回时间序列在时间索引 `t` 处的指数平滑移动平均值之和。

# exponentialTimeDecayedSum

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

引入版本：v21.12.0

返回时间序列在时间索引 `t` 处按指数平滑后的移动平均值之和。

**语法**

```sql theme={null}
exponentialTimeDecayedSum(x)(v, t)
```

**参数**

* `x` — 使某个值的权重衰减到 1/e 所需的时间差。[`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float) 或 [`Decimal`](/zh/reference/data-types/decimal)

**Arguments**

* `v` — 值。[`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float) 或 [`Decimal`](/zh/reference/data-types/decimal)
* `t` — 时间。[`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float) 或 [`Decimal`](/zh/reference/data-types/decimal) 或 [`DateTime`](/zh/reference/data-types/datetime) 或 [`DateTime64`](/zh/reference/data-types/datetime64)

**返回值**

返回给定时间点的指数平滑移动平均值之和。[`Float64`](/zh/reference/data-types/float)

**示例**

**窗口函数用法的可视化表示**

```sql title=Query theme={null}
SELECT
    value,
    time,
    round(exp_smooth, 3),
    bar(exp_smooth, 0, 10, 50) AS bar
FROM
    (
    SELECT
    (number = 0) OR (number >= 25) AS value,
    number AS time,
    exponentialTimeDecayedSum(10)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth
    FROM numbers(50)
    );
```

```response title=Response theme={null}
┌─value─┬─time─┬─round(exp_smooth, 3)─┬─bar───────────────────────────────────────────────┐
│     1 │    0 │                    1 │ █████                                             │
│     0 │    1 │                0.905 │ ████▌                                             │
│     0 │    2 │                0.819 │ ████                                              │
│     0 │    3 │                0.741 │ ███▋                                              │
│     0 │    4 │                 0.67 │ ███▎                                              │
│     0 │    5 │                0.607 │ ███                                               │
│     0 │    6 │                0.549 │ ██▋                                               │
│     0 │    7 │                0.497 │ ██▍                                               │
│     0 │    8 │                0.449 │ ██▏                                               │
│     0 │    9 │                0.407 │ ██                                                │
│     0 │   10 │                0.368 │ █▊                                                │
│     0 │   11 │                0.333 │ █▋                                                │
│     0 │   12 │                0.301 │ █▌                                                │
│     0 │   13 │                0.273 │ █▎                                                │
│     0 │   14 │                0.247 │ █▏                                                │
│     0 │   15 │                0.223 │ █                                                 │
│     0 │   16 │                0.202 │ █                                                 │
│     0 │   17 │                0.183 │ ▉                                                 │
│     0 │   18 │                0.165 │ ▊                                                 │
│     0 │   19 │                 0.15 │ ▋                                                 │
│     0 │   20 │                0.135 │ ▋                                                 │
│     0 │   21 │                0.122 │ ▌                                                 │
│     0 │   22 │                0.111 │ ▌                                                 │
│     0 │   23 │                  0.1 │ ▌                                                 │
│     0 │   24 │                0.091 │ ▍                                                 │
│     1 │   25 │                1.082 │ █████▍                                            │
│     1 │   26 │                1.979 │ █████████▉                                        │
│     1 │   27 │                2.791 │ █████████████▉                                    │
│     1 │   28 │                3.525 │ █████████████████▋                                │
│     1 │   29 │                 4.19 │ ████████████████████▉                             │
│     1 │   30 │                4.791 │ ███████████████████████▉                          │
│     1 │   31 │                5.335 │ ██████████████████████████▋                       │
│     1 │   32 │                5.827 │ █████████████████████████████▏                    │
│     1 │   33 │                6.273 │ ███████████████████████████████▎                  │
│     1 │   34 │                6.676 │ █████████████████████████████████▍                │
│     1 │   35 │                7.041 │ ███████████████████████████████████▏              │
│     1 │   36 │                7.371 │ ████████████████████████████████████▊             │
│     1 │   37 │                7.669 │ ██████████████████████████████████████▎           │
│     1 │   38 │                7.939 │ ███████████████████████████████████████▋          │
│     1 │   39 │                8.184 │ ████████████████████████████████████████▉         │
│     1 │   40 │                8.405 │ ██████████████████████████████████████████        │
│     1 │   41 │                8.605 │ ███████████████████████████████████████████       │
│     1 │   42 │                8.786 │ ███████████████████████████████████████████▉      │
│     1 │   43 │                 8.95 │ ████████████████████████████████████████████▊     │
│     1 │   44 │                9.098 │ █████████████████████████████████████████████▍    │
│     1 │   45 │                9.233 │ ██████████████████████████████████████████████▏   │
│     1 │   46 │                9.354 │ ██████████████████████████████████████████████▊   │
│     1 │   47 │                9.464 │ ███████████████████████████████████████████████▎  │
│     1 │   48 │                9.563 │ ███████████████████████████████████████████████▊  │
│     1 │   49 │                9.653 │ ████████████████████████████████████████████████▎ │
└───────┴──────┴──────────────────────┴───────────────────────────────────────────────────┘
```
