Cohorts Calculation Explained

Cohorts let you define user groups that update automatically based on shared behaviors or properties, such as making a purchase or installing an app within a specific time period.

This article explains the calculation logic behind Cohorts. 

For more information on getting started with Cohorts and understanding what Cohorts are under the hood, check out these articles for additional details:

How Cohort Logic Works

At its core, defining a cohort involves combining conditions using logic operations like: 

  • AND - means all conditions must be true. Users are included only if they appear in every condition.

  • OR - means any of the conditions can be true. Users are included if they match at least one condition.

When more than one condition is used, Countly evaluates them left to right in the order they appear. This can affect your results when AND and OR are combined. 

For example: 

Condition A OR Condition B OR Condition C AND Condition D

This will then be processed as: 

(((Condition A OR Condition B) OR Condition C) AND Condition D)

Cohort Logic Examples

Let's look at how the cohort logic works using example users and events: 

Say we have a group of 10 users: 

Cohort A

Users who performed Event 1 OR Event2 OR Event 3

Results:

[u1, u2, u3] are all users who performed any of the three events; therefore, they will be added to Cohort A.


Cohort B 

Users who performed Event 1 OR Event 2 AND did not perform Event 3

Result:

[u1 and u2] both will be added to Cohort B.


Cohort C 

Users who did not perform Event 1 AND did not perform Event 2 OR performed Event 3:

Result: 

[u3, u4, u5, u6, u7, u8, u9, u10] will be added to Cohort C as they match the conditions.

Was this page helpful?
Reach out to us for any other questions.
Helpful?

Looking for more Help?