# Set Up a Calculated Field

**Limited**: Calculated custom fields areonly available to certain product editions. [Contact support](https://app.impact.com/support/portal.ihtml?createTicket=true&) to upgrade your advocate program and gain access.

Calculated fields enable you to track events as they come in, set up a calculation using event fields, and store the resulting data on a participant’s profile. Once the calculated field is set up, its value will update dynamically as you send impact.com events that meet your criteria.

This guide will show you the basic process for setting up a calculated field, including an example at the end. For more details about how calculated fields work and what types of calculations are possible, refer to [Calculated Fields Explained](https://help.impact.com/brand/advocate-program/manage-advocate-participants/custom-and-calculated-fields/calculated-fields-explained).

#### Set up a calculated field

1. From the left navigation menu, select ![](https://4048883401-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. Select **Create calculated field**.
3. Complete the fields:
   * **Name**
   * **Event**
   * **Calculation**
   * **Event field** (if applicable for your calculation)
4. Optionally, apply a **Tracking Window** if you want to perform a sum or count calculation on a rolling basis. The time zone for your impact.com account will apply to the tracking window.
   * ![](https://4048883401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-d0b6669ae76a7bef06a8d6940d7ad5c16bb8d018%2F7cb018d4face8d7cceb880eb5086c812e764fbcfe6f2a0377f88bc7576973070.svg?alt=media) **\[Toggle on]** if you want to only include events in calculations. For details about the window types and when to use them, see [Tracking Windows for Calculated Fields](https://help.impact.com/brand/advocate-program/manage-advocate-participants/custom-and-calculated-fields/tracking-windows-for-calculated-fields-explained)
5. If you applied a sliding window, then you can set a maximum value to be counted for each unit of your interval (e.g., each day in a 60 day interval).
6. In the *Filters* field, add an **Active Period** if you want to set a start and end date for the calculation.
7. Select ![](https://4048883401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-6282f271b7521383385339243690b303086736d9%2F3b5a585dd2895bdf1c30d1236c72ba590dddd18717863b27074c8d313d05ae20.svg?alt=media) **Additional filters** if you only want events that meet specific criteria to be included in the calculation.
   * Filters can apply to event characteristics (e.g., revenue amount for a given purchase) or user characteristics (e.g., a count of the number of times a participant makes a purchase over $100)
8. **Review** your selections and decide if you want to [backfill the values](https://help.impact.com/brand/advocate-program/manage-advocate-participants/custom-and-calculated-fields/edit-a-calculated-field) for all participants.
   * Select the ![](https://4048883401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-d2954616dc486c3e12c9211e20ff376bda0ab1af%2F7586e04e82e7c7203e5c82320dd417f8ac564cae5035024fdf0eb2ed017e6376.svg?alt=media) **\[Checked box]** if you want to backfill calculations.
9. Select **Save** to have your changes saved.

#### Example

* You have a referral program and want to reward participants who frequently make sizable purchases soon after they’ve been referred. You determine that for your program, this means any participant who makes 3 or more purchases of at least $50 in the month after the referral starts. A calculated field can help you determine which of your participants meet this threshold and act as the basis for a program rule that issues these participants a reward.

<details>

<summary>Setup instructions</summary>

Here’s how the calculation can be set up:

1. Under the **Calculation**, complete the **Name** field.
2. Enter the following values for the event and calculation fields:
   * **Event**: Purchase
   * **Calculation**: Count
     * This will set up the calculation to count how many times impact.com receives purchase events that meet your criteria.
3. Apply a fixed **Tracking Window**. This will cause the calculation to reset each month.
   * Select **Fixed Window**.
   * Select a **1 calendar month** window duration.
4. Add **Filters** to specify that you only want to count the purchase events with a value of $50 or more:

   * Select **Add Rule**.
   * For the first Condition ![](https://4048883401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-c2cb550b55c51ea1eeff0acbd6f437a03b621a2c%2F60d033ae8a04c14498d5229c3c0160ac05feea7f605dbd770741793c900469f0.svg?alt=media) **\[Drop-down menu]**, select the `events.fields.revenue` field.
   * Change the operator type to **greater than or equal to**.
   * Enter `50` as the string variable value.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Note:</strong> JSONata expressions only accept whole numbers. When using currency, impact.com recommend using the lowest denomination used in your database configuration. If you’re not sure, <a href="http://saasquatch-support@impact.com">contact our support team</a> for help.</p></div>
5. Review and **Save**.

</details>
