Aggregates and Running Aggregates
Aggregates are custom customer attributes that are calculated from already existing data. They help you calculate aggregated information for every customer. An example of aggregate would be calculating a customer's lifetime value: In your report, you would use
Running aggregates are custom event attributes, which is the main difference to aggregates. They help you calculate aggregated information for any event. Running aggregates can be used in almost any analytical part of Bloomreach Engagement.
|minimum / maximum||Returns the smallest / biggest value from the dataset.|
|sum||Sums values in the dataset. For example, |
|count||Count the number of data points. For example, |
|avg (average)||Returns the average of all values of that specific event.|
|first / last||Returns the value of the first / last occurrence of that event.|
|exists||Returns either 1 or 0. For example, if a customer never purchased before, then |
|most common||Returns the most common value, such as the most viewed item.|
|count distinct||This counts distinct values in a data set, such as how many different categories a specific customer viewed.|
|distinct values||Lists all the unique values within an aggregate.|
most commonaggregate type, in case there are two (or more) equal outcomes, Bloomreach Engagement picks the first one that occurred in the event history.
When using decimal numbers, make sure to denote them by
12.34) as otherwise,
avgor other mathematical aggregates will not work properly
Grasping aggregates and running aggregates and the difference between them might be a bit tricky at the beginning. That's why we created this short video that explains the topic for you. We do recommend watching it as you will be using (running) aggregates very often in Bloomreach Engagement.
How to create a (running) aggregate
It can be created in two ways:
- Go to
Data & Assets>
- Aggregates/running aggregates can also be created when selecting customer attributes/events for your analysis wherever it is possible. If you wish, you can also save them for later use (so next time it appears in the list) by clicking on the save button as shown below.
The process of creating an aggregate is simple:
a. Select the calculation operator (sum, first, last ...)
b. Select the event with which you want to calculate the aggregate. For example
Count > purchase calculates the number of purchases for all customers.
c. You can specify the metric further by adding an attribute of the event. For example
Sum > purchase > total_price will calculate the total revenue generated by each customer.
Running aggregates: The difference between including/excluding the event itself
Running aggregates contain one additional setting, which is deciding whether to include or exclude the event itself from the calculation. This setting is relevant when the anchor event is identical to the event from which the running aggregate is calculated. See the 2 Use Cases about calculating revenue and conversion rate by country below for a better understanding.
'Skip first' function
You can skip any number of values for the
most common aggregates. For example, you can use the aggregate "first purchase timestamp > skip 1", which will give you the timestamp of the second purchase of that particular customer.
For distinct aggregate, it has 100% precision if there are less than 10k unique values. If there are more values, it has around 97% precision.
Example use cases
Aggregates can be used for filtering and segmenting customers or in expressions. They are usually used in campaign filters. Check out these examples to see what kind of insights are available through aggregates. Notice every analysis related to a customer.
How many purchases does a customer have in total?
How many times customer visited our page in the last 30 days?
What is a customer’s total lifetime value?
What is the average customer purchase when using loyalty points for purchase?
What was the referrer of a customer’s first visit to the webpage?
How many emails has the customer received from us in the last 14 days?
What was the last product the customer viewed?
What is the revenue per country?
If you don't track
country as an attribute of the
purchase event, then you need to retrieve it from the
session_start event using a running aggregate. For every purchase in the past Bloomreach Engagement will look a the
last session_start > country that preceded that purchase and will attribute that purchase to the country which is tracked there.
Note: Changing the
including/excluding operator does not make a difference here. Read the next use case for further explanation.
What is the conversion rate per country?
The metric (conversion rate) is, in this case, a formula that uses two types of events – session_start and purchase – meaning that the report cannot be broken down by an attribute of one, or the other. As mentioned above, the attribute ‘country’ is tracked for event session_start, but usually not for event purchase.
The running aggregate you will need for this report looks like this:
Here, it is crucial to switch from excluding to including. We essentially have two anchor events in this case –
purchase. The running aggregate will look for the country of the
last session_start both before every
purchase event and before every
session_start event, including that very event. In other words, the
including/excluding setting matters here because the running aggregate is calculated from one of the anchor events -
The report will look like this:
You may have noticed that, in this case, you have to insert the running aggregate into Rows, before inserting the Metric. Once you insert a formula that uses two types of events under Metrics, you won't be able to choose an event attribute (or running aggregate) under Rows anymore. So make sure to start with Rows in such cases.
What was the referrer for the last session_start of this event (for example: purchase)?
When was the last time a specific weblayer was viewed by any customer?
When was the last time an email was delivered to any customer?
Updated 21 days ago