> For the complete documentation index, see [llms.txt](https://help.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/calculated-fields-explained.md).

# 计算字段说明

**有限**：计算型自定义字段仅适用于某些产品版本。 [联系支持](https://app.impact.com/support/portal.ihtml?createTicket=true&) 以升级您的倡导者计划并获得访问权限。

通过 [自定义字段](/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/custom-fields-for-advocate-explained.md)，您可以向 impact.com 发送有关您的 Advocate 参与者的各种附加信息，超出运行您的推荐计划所需的基本信息。

计算字段接收用户和事件数据，其值会被计算、存储，并显示在参与者的个人资料中。一旦设置好计算字段，当您发送符合条件的 Advocate 计划事件时，其值将动态更新。

{% hint style="info" %}
**示例：** 可将计算字段配置为统计参与者在一个月窗口内购买至少 100 美元的次数。然后，您可以设置计划，为在一个月内完成至少 3 次此类 100 美元购买的参与者发放特殊奖励。
{% endhint %}

#### 默认计算字段

默认情况下，系统会提供四个计算字段。您一开始设置计划规则时就可以引用这些字段。

<details>

<summary>默认计算字段</summary>

| 计算字段   | 说明                             |
| ------ | ------------------------------ |
| 上次查看日期 | 跟踪用户在 Advocate 中最后一次被插入或更新的时间。 |
| 首次购买日期 | 跟踪我们收到该参与者购买事件的首个日期。           |
| 上次购买日期 | 跟踪该参与者最近一次购买事件的日期。             |
| 购买总次数  | 跟踪该参与者的购买事件总数。                 |

</details>

#### 客户创建的计算字段

您可以创建超出系统默认字段之外的自定义计算字段。设置计算字段时，您可以：

* 如果希望计算仅在限定时间内运行，可以添加开始日期和结束日期（例如 1 月 1 日至 2 月 17 日）。这个设定的时间范围称为活动期。
* 指定一个周期性 [跟踪窗口](/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/tracking-windows-for-calculated-fields-explained.md) 用于您的求和和计数计算。跟踪窗口可以是固定窗口（例如单个日历月或年），也可以是滚动窗口（例如最近 90 天）。
* 通过添加筛选器或编写 JSONata 表达式，为计算执行时机设置额外约束。本文中的相关文章将对此选项进行更详细的讨论 [设置计算字段](/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/set-up-a-calculated-field.md).

{% hint style="info" %}
**注意：** 如果您的计算字段具有活动期或跟踪窗口，则在计算期结束后，值将不会更新。如果您的计算字段具有活动期（对于求和/计数计算，仅限跟踪窗口），则在计算期结束后，值将不再进一步更新。不过，这些值仍会显示在每位参与者的个人资料中。
{% endhint %}

<details>

<summary>客户创建的计算字段</summary>

构建计算字段时，您可以使用多种计算类型。

| 计算       | 说明                                              | 示例                                            |
| -------- | ----------------------------------------------- | --------------------------------------------- |
| 求和       | 计算以下内容的总和： `{fieldname}` 字段中的 `{eventkey}` 事件   | 汇总被推荐好友在注册后前 30 天内进行的所有购买。根据消费金额向客户倡导者发放分级奖励。 |
| 计数       | 统计以下项目的数量： `{eventkey}` 事件                      | 当参与者完成超过 10 笔购买时给予奖励。                         |
| 首次出现（日期） | 计算首次的时间戳 `{eventkey}` 事件                        | 如果参与者在某个日期之前开始购买，则给予奖励。                       |
| 最后出现（日期） | 计算最后一次的时间戳 `{eventkey}` 事件                      | 如果参与者的上一次购买发生在 5 天内，则给予奖励。                    |
| 首个值      | 计算以下内容的值： `{fieldname}` 字段在首次 {eventkey} 事件中的值  | 当参与者首次大额购买时给予奖励。                              |
| 最后一个值    | 计算以下内容的值： `{fieldname}` 字段在最近一次 `{eventkey}` 事件 | 当参与者的最后一次付款达到某个最低金额时给予奖励。                     |

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/calculated-fields-explained.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
