Use the following tables and lists to help you define each calculated attribute.
The following table lists all supported calculations.
Group | Calculation Type | Format | Example | Trigger |
---|---|---|---|---|
Count | Count | Numeric | 123 |
*synchronous |
Aggregation | Sum | Numeric | 123.123 |
*synchronous |
Aggregation | Minimum | Numeric | 123.123 |
*synchronous |
Aggregation | Maximum | Numeric | 123.123 |
*synchronous |
Aggregation | Average | Numeric | 123.123 |
asynchronous |
Aggregation | Most frequent | Dynamic | romance |
asynchronous |
Aggregation | Unique values count | Numeric | 34 |
asynchronous |
Occurrence | First value | Dynamic | comedy |
asynchronous (until observed) |
Occurrence | Last value | Dynamic | action |
asynchronous |
Occurrence | First timestamp | Timestamp | 2020-01-01T22:14:47.1051728Z |
asynchronous (until observed) |
Occurrence | Last timestamp | Timestamp | 2020-01-10T22:14:47.1051728Z |
*synchronous |
List | Unique list | Comma separated list of dynamic values; maximum of 100. | "Item 1","Item 2","Item 3" |
*synchronous |
*Setting the date range to Within the Last causes all calculations to be asynchronous.
Be aware of the following before creating your calculation attributes:
First
Value` returns a string if the selected event attribute is a string. All attribute values in our platform are stored as strings, including calculated attributes.For aggregation CAs:
Most Frequent
or Unique List
CA, no more values are collected. For Most Frequent
, the frequency of the first 100 are continuously evaluated, but no new values are added. For Unique List
, mParticle keeps only the first 100 seen values. To trigger a re-collection of values for either calculation type, edit the CA definition or create a new one.The following date ranges in calculated attributes are supported:
Some calculated attributes, like sum
, require numeric event attributes to function. If you select an attribute that is not detected as the correct type, the platform will warn you about using those fields in the calculated attribute definition. You can still use the calculated attribute despite the warning, and it will attempt to convert the string values into numerics. For example, if you pass the attribute amount
in as a numeric string like "34.32"
, a sum
calculation will still work correctly: the string "34.32"
will be converted to the decimal value 34.32
.
When you define a calculated attribute, you can add conditional logic. For example, if you wanted to count the total number of times a promotion was clicked, but only for certain currencies, you could add the condition “where the currency code is only AUD or EUR.”
The following conditions are available for all four categories of calculated attributes (Count, Aggregation, Occurrence, and List):
The following behaviors affect commerce event attributes (commerce_events
) in some calculated attributes:
The product action (product_action
) and product impression (product_impression
) attributes can be used in the quantity field for calculations. Note the following behaviors:
The promotion action (promotion_action
) attribute can be used in the quantity field for calculations. Note the following behaviors:
Was this page helpful?