> 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/set-up-a-calculated-field.md).

# 设置计算字段

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

计算字段可让您跟踪收到的事件，使用事件字段设置计算，并将计算结果存储在参与者的个人资料中。设置好计算字段后，只要您发送符合条件的 impact.com 事件，其值就会动态更新。

本指南将介绍设置计算字段的基本流程，并在末尾提供一个示例。如需详细了解计算字段的工作方式以及可执行的计算类型，请参阅 [计算字段详解](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).

#### 设置计算字段

1. 在左侧导航菜单中，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-230534471fef5f40808e921e41ee44e4a06ded03%2Fe6cb9548999afdc1ed3ce4942e4cb5b45b5cecbd323267aac2a7cd1915fccc09.svg?alt=media) **\[Engage] → Data Sources → Fields**.
2. 选择 **Create calculated field**.
3. 填写以下字段：
   * **名称**
   * **事件**
   * **计算**
   * **事件字段** （如果适用于您的计算）
4. 您还可以设置 **跟踪窗口** ，以便按滚动方式进行求和或计数计算。impact.com 账户的时区将应用于跟踪窗口。
   * ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FiZjM1xY8o3v1iR3Zaysd%2FToggle.svg?alt=media\&token=b1550d48-bba9-4e81-8604-bc12370c5caa) **\[开启开关]** ，以便仅将窗口内的事件纳入计算。有关窗口类型及其适用场景的详情，请参阅 [计算字段的跟踪窗口](https://help.impact.com/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)
5. 如果您应用了滑动窗口，可以设置每个间隔单位（例如 60 天间隔中的每一天）可计入的最大值。
6. 在 *筛选条件* 字段中，添加 **生效期限** ，以便为计算设置开始日期和结束日期。
7. 选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-6282f271b7521383385339243690b303086736d9%2F3b5a585dd2895bdf1c30d1236c72ba590dddd18717863b27074c8d313d05ae20.svg?alt=media) **其他筛选条件** 以便仅将符合特定条件的事件纳入计算。
   * 筛选条件可以针对事件特征（例如某笔购买的收入金额）或用户特征（例如参与者购买金额超过 100 美元的次数）设置。
8. **检查** 您的选择，并决定是否要为所有参与者 [回填数值](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/edit-a-calculated-field.md) 。
   * 如果要回填计算结果，请勾选 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FwXho9QKP3e4iU4ZKUSJ5%2F167ebb8cc30303.svg?alt=media\&token=a046e9f0-63aa-46f6-8a35-f73973fd326c) **\[已勾选的复选框]** 。
9. 选择 **保存** 以保存您的更改。

#### 示例

* 您有一个推荐计划，希望奖励那些被推荐后不久就频繁进行大额购买的参与者。您认为，对于您的计划，这意味着在推荐开始后的一个月内至少购买 3 次、且每次金额不低于 50 美元的参与者。计算字段可以帮助您确定哪些参与者达到此门槛，并作为计划规则的依据，向这些参与者发放奖励。

<details>

<summary>设置说明</summary>

以下是设置此计算的方法：

1. 在 **计算**下，填写 **名称** 字段。
2. 为事件和计算字段输入以下值：
   * **事件**：购买
   * **计算**：计数
     * 这将设置计算方式，统计 impact.com 收到的、符合条件的购买事件次数。
3. 应用固定 **跟踪窗口**。这样每月都会重置计算。
   * 选择 **固定窗口**.
   * 选择 **1 个日历月** 作为窗口时长。
4. 添加 **筛选条件** ，指定仅统计金额为 50 美元或以上的购买事件：

   * 选择 **添加规则**.
   * 对于第一个条件 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-c2cb550b55c51ea1eeff0acbd6f437a03b621a2c%2F60d033ae8a04c14498d5229c3c0160ac05feea7f605dbd770741793c900469f0.svg?alt=media) **\[下拉菜单]**，选择 `events.fields.revenue` 字段。
   * 将运算符类型更改为 **大于或等于**.
   * 输入 `50` 作为字符串变量值。

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>注意：</strong> JSONata 表达式仅接受整数。使用货币时，impact.com 建议采用数据库配置中使用的最小面额。如果不确定， <a href="http://saasquatch-support@impact.com">请联系我们的支持团队</a> 寻求帮助。</p></div>
5. 检查并 **保存**.

</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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
