This article will help you:
Like cohorts, computations are a segmentation tool. But where cohorts create lists of users, computations convert events into a new user property you can use to segment your users.
Computations work by transforming an event or event property into a computed user property. You can use the computed property as a configurable filter in any Amplitude chart for analysis, or as a personalization tool by syncing it to an external destination.
Here’s an example. If you want to segment your users by the number of purchases they’ve made, you can use cohorts to do this—however, you’d have to create a different cohort to correspond to each possible number of purchases, an approach that could quickly become cumbersome and time-consuming.
As an alternative, you could create a computed property (number of orders, say), which will store the relevant number as a single integer, attached to each individual user. And while either a cohort or a computation would get the job done, in this use case, a computed property would be the more elegant and flexible choice.
Computed properties are ideal tools for personalization campaigns. There are two types of computed properties:
- Event count: this property type counts the number of times a user has fired an event over a defined period of time.
- Aggregation: This property type aggregates the sum, minimum, maximum, or average of the values of an event property over a defined period of time.
Create a computed property
To create a new computed property, follow these steps:
- Navigate to Computations → Create Computation.
- Under Computation Type, select the type of computed property you want to create and click Next >.
- Under Select an Event, choose the event you’re interested in building your computed property from:
- For event count computed properties, you can filter the event using + where clauses to add any conditions you may wish to include.
- For aggregation computed properties, select an event and the related event property you want to aggregate. Specify if you want to compute an average, minimum, maximum, or sum value.
NOTE: The event property value must be expressed as an integer for the aggregation to work.
- Set the date range for your computed property. The maximum is 365 days. When you’re done, click Next >.
- Name your computation. This name will appear as a user property on every user. Then click Next >.
- Finally, take a moment to review your results. The computation will take a few seconds to generate. Amplitude Audiences will apply it to all users who were active during your specified date range. In the details view, you can see the configuration details of the computation, as well as a distribution of all users, the number of users who’ve fired the event at different counts (event count only), and a distribution of all users by distinct binned aggregation values (aggregation only).
Delete a computation
You can delete a computation at any time after you've created it. To do so, follow these steps:
- Click Computations in the left-side rail.
- Click the name of the computation you wish to delete.
- From the More drop-down menu, click Delete.
- Confirm that you want to delete this computation.
When you delete a computation, it will no longer show up as an available user property for your cohorts. You will be unable to sync it or filter from it within your cohorts. At the same time, deleting unneeded computations will free up space for you to create new, more useful ones.
Use computed properties in campaigns and analyses
Computed properties are most often used in personalization campaigns. Just sync the computed property as a user property to external destinations, like a database or third-party marketing platform.
For example, you can use a computed property to calculate the total number of orders a user has placed, and then use that information to trigger a different canvas in Braze if that number reaches a certain amount. You could also use computed properties to calculate users’ average order values, sync to the Profile API, and then show users different interstitials in the app, based on their average order values.
Amplitude Audiences supports Braze, S3, and the Profile API as destinations for computed property syncs. Note that the process of syncing to Braze will accrue more data points in your Braze plan, which may result in an additional charge from Braze.
To sync your computed property with a personalization tool, follow the instructions in our article on syncing properties, recommendations, and cohorts to third-party destinations.
Computed properties can also be used as a filter in Amplitude’s Analytics product, in both cohorts and charts. Just choose your computed property as a filter parameter in a cohort; then save the cohort. From there, you can select that cohort in any Amplitude chart as a segmentation parameter. Use it to compare funnel conversion rates or retention rates between different cohorts: comparing users with different average order values, minimum purchase price, etc.
You can also query directly on a computed property in a chart, as either a property filter or a group-by option.