> 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/ja/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&) アドボケイトプログラムをアップグレードしてアクセス権を取得してください。

を通じて [カスタムフィールド](https://help.impact.com/brand/ja/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/custom-fields-for-advocate-explained.md)を使用すると、紹介プログラムの運用に必要な基本情報に加えて、アドボケイト参加者に関する幅広い追加情報をimpact.comに送信できます。

計算フィールドはユーザーおよびイベントのデータを受け取り、その値が計算・保存され、参加者のプロフィールに表示されます。計算フィールドを設定すると、条件に合致するアドボケイトプログラムのイベントを送信するたびに、その値が動的に更新されます。

{% hint style="info" %}
**例：** たとえば、計算フィールドを設定して、参加者が1か月の間に100ドル以上の購入をした回数を数えることができます。その後、1か月にこの100ドル以上の購入を3回以上行った参加者に特別な特典を付与するよう、プログラムを設定できます。
{% endhint %}

#### デフォルトの計算フィールド

デフォルトで4つの計算フィールドが用意されています。プログラムのルール設定を始めるとすぐに、これらを参照できます。

<details>

<summary>デフォルトの計算フィールド</summary>

| 計算フィールド            | 説明                                  |
| ------------------ | ----------------------------------- |
| lastSeenDate       | ユーザーがAdvocateで最後にアップサートされた日時を記録します。 |
| firstPurchaseDate  | この参加者の購入イベントを最初に受信した日付を記録します。       |
| lastPurchaseDate   | この参加者の最新の購入イベントの日付を記録します。           |
| totalPurchaseCount | この参加者の購入イベントの合計数を記録します。             |

</details>

#### クライアント作成の計算フィールド

用意されているデフォルトのフィールドに加えて、独自の計算フィールドを作成できます。計算フィールドの設定では、次のことができます。

* 計算を一定期間（例：1月1日から2月17日まで）実行する場合は、開始日と終了日を追加します。この期間を有効期間と呼びます。
* 繰り返し可能な [追跡期間](https://help.impact.com/brand/ja/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式を記述して、計算を実行する際の追加条件を設定します。これらのオプションについては、記事「 [計算フィールドの設定](https://help.impact.com/brand/ja/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 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/ja/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/calculated-fields-explained.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.
