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 sum>purchase>total_price.

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 in Exponea.

Aggregate types

minimum / maximum

Returns the smallest / biggest value from the dataset.

sum

Sums values in the dataset. For example, sum > purchase > total_price will return the total spend.

count

Count the number of data points. For example, count > purchase will return the number of purchases.

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 exists > purchase will return 0 and vice versa.

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.

📘

For the most common aggregate type, in case there are two (or more) equal outcomes, Exponea picks the first one that occurred in the event history.

🚧

When using decimal numbers, make sure to denote them by . (e.g. 12.34) as otherwise, sum , avg or 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 to watch it as you will be using (running) aggregates very often in Exponea.

How to create a (running) aggregate

It can be created in two ways:

  • Go to Data & Assets > Data manager > Definitions > New definition.
  • 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.

Aggregates can be found under CUSTOMER while running aggregates are under EVENT

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 of this.

"Skip first" function

You can skip any number of values for the first, last and most common aggregates. For example, you can use the aggregate "first purchase timestamp > skip 1", which will give you the timestamp of second purchase of that particular customer.

Example use cases

Aggregates

Aggregates can be used for filtering and segmenting customers and 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 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 customer received from us in the last 14 days?

What was the last product the customer viewed?

Running aggregates

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 Exponea 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. Moreover, as mentioned above, the attribute ‘country’ is tracked for event session_start, but not (normally) 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 – session_start and 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 - session_start.

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 will not 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 web layer was viewed by any customer?

When was the last time an email was delivered to any customer?

Updated 2 months ago


Aggregates and Running Aggregates


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.


We rely on cookies

to optimize our communication and to enhance your customer experience. By clicking on the Accept and Close button, you agree to the collection of cookies. You can also adjust your preferences by clicking on Manage Preferences. For more information please see our Privacy policy.

Manage cookies
Accept & close

Cookies preferences

Accept & close
Back