Help Center

| Submit or View Help Requests | Developer Docs |
| |

Calculated Fields Explained

Through custom fields, you can send impact.com a wide range of additional information about your Advocate participants beyond the basics required to run your referral program.

Calculated fields take this concept a step further. As user and event data are received by a calculated field, the values are calculated, stored and become visible on the participant’s profile. Once the calculated field is set up, its value will update dynamically as you send your Advocate program events that meet your criteria.

Calculated field values can be used in setting up your program rules, allowing for a wide range of advanced program logic. For example, a calculated field can be configured to count how many times a participant makes a purchase of at least $100 in a one-month window. Then, you can set up your program to issue special rewards to participants who make at least 3 of these $100 purchases in a month.

Default calculated fields

All clients are supplied with four calculated fields by default. You can reference these as soon as you start setting up the rules for your program.

Default calculated fields

Calculated field

Description

lastSeenDate

Tracks the last time the user was upserted in Advocate.

firstPurchaseDate

Tracks the first date that we received a purchase event for this participant.

lastPurchaseDate

Tracks the date of the participant’s most recent purchase event.

totalPurchaseCount

Tracks the total number of purchase events for this participant.

Client-created calculated fields

You can create your own calculated fields that go beyond the default ones provided. When you set up a calculated field, you can:

  • Add a start and end date if you want the calculation to run for a limited time (e.g., January 1st to February 17th). This set time frame is called an active period.

  • Specify a recurring tracking window for your sum and count calculations. Tracking windows can be either fixed windows (e.g., a singular calendar month or year) or sliding windows (e.g., last 90 days).

  • Set additional constraints for when the calculation is performed by adding a filter or writing a JSONata expression. These options are discussed in greater detail in our article Setting Up a Calculated Field.

Note

If your calculated field has an active period or tracking window, then values won’t be updated after the calculation period ends. If your calculated field has an active period (or a tracking window, for sum/count calculations only), then values won’t be further updated after the calculation period ends. However, the values will remain visible on each participant’s profile.

Client-created calculated fields

Calculation

Description

Example

Sum

Calculate the sum of the {fieldname} field from {eventkey} events

Sum all purchases a referred friend makes within the first 30 days after signup. Issue tiered rewards to the customer advocate based on the amount spent.

Count

Count the number of {eventkey} events

Reward participants when they have made more than 10 purchases.

First Seen (Date)

Calculate the timestamp of the first {eventkey} event

Reward participants if they started making purchases before a certain date.

Last Seen (Date)

Calculate the timestamp of the last {eventkey} event

Reward participants if their last purchase was within 5 days.

First Value

Calculate the value of the {fieldname} field from the first {eventkey} event

Reward participants when they make a large first purchase.

Last Value

Calculate the value of the {fieldname} field from the most recent {eventkey} event

Reward participants when their last payment was at least a certain value.

Available calculations

There are several types of calculations that you can use when building a calculated field.

Create and manage calculated fields from your Advocate program's Data Sources → Fields page. See Setting Up a Calculated Field for help doing so.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.