Cohort Analysis in Tableau

Cohort Analysis in Tableau

4 mins read1.3K Views Comment
Vikram
Vikram Singh
Assistant Manager - Content
Updated on Sep 2, 2024 09:22 IST
Learn how to create a Cohort in Tableau with this straightforward tutorial. This guide breaks down the steps to help you track and analyze user behaviour over time, making it easier to uncover trends and drive smarter decisions. Dive in now to enhance your Tableau skills and take your data analysis to the next level!
Cohort Analysis in Tableau

Table of Content

What is Cohort Analysis?

Before defining Cohort Analysis, let’s understand what Cohort is?

A cohort is a collection (or a subset) of users with common characteristics.

In terms of business, a cohort refers to the users that are grouped by the acquisition date.

A Cohort Analysis is an analytical technique that categorises and divides the data into groups of common characteristics (or properties) before analysis. 

It allows comparing the behaviour and metrics of different groups over time. Using cohort analysis, you can find the performance and factors affecting the cohort’s performance.

Let’s understand with the help of an example:

Problem Statement: A company launched an app five days ago. Now, the company wants to know the daily cohort of users who comes to the app on the very first and revisit in the next five working days.

2022_06_cohort-analysis_example.jpg

From the above retention table, you can easily depict the number of users who visited that app and the % of active users on different dates. Finally, the critical point is the retention rate of the users over the app.

Out of all the new users in the last five working days (7475), only 50% of users are retained on day 5.

Must Check: What is Tableau?

Must Check: Tableau Online Courses & Certifications

Recommended online courses

Best-suited Tableau courses for you

Learn Tableau with these high-rated online courses

39.54 K
2 hours
– / –
45 hours
– / –
4 weeks
– / –
4 weeks
2.25 K
4 weeks
Free
12 hours
– / –
1 hours
19.89 K
16 hours
– / –
3 hours
19.7 K
6 months

How to do Cohort Analysis in Tableau?

We will understand how to do cohort analysis in Tableau with an example.

Problem Statement: In Sample Super Store Data, using cohort analysis, compute the number of distinct customers who purchased the items(product) again.

We will solve the above problem in two steps:

  • Create Calculated Fields
    • Compute the first purchase date of each customer
    • Compute the next purchase date of each customer
      • If the order dates are the same, then return NULL
    • Compute the second purchase date by setting a minimum of the next purchase date
    • Compute the month difference between the first purchase date and the second Purchase date
  •  Build View
    • Here we will create a visualization
How to Create a Word Cloud in Tableau
How to Create a Forecast in Tableau
How to Create Hierarchies in Tableau

Create Calculated Field

  • Connect Sample Super Store Data
  • Select Analysis -> Create Calculated Fields
    • Dialog Box Will appear
      • Create First Purchase Date using Minimum of Order Date
2022_06_COHORT-ANALYSIS_FIRST-PURCHASE-DATE.jpg
  • Select Analysis -> Create Calculated Fields
    • Create Next Purchase Date using if-else
2022_06_COHORT-ANALYSIS_NEXT-PURCHASE-DATE.jpg
  • Select Analysis -> Create Calculated Fields
    • Create Second Purchase Date using the minimum of the Next Purchase Date
2022_06_COHORT-ANALYSIS_SECOND-PURCHASE-DATE.jpg
  • Select Analysis -> Create Calculated Fields
    • Create Month Difference using DATEDIFF
2022_06_COHORT-ANALYSIS_MONTH-PURCHASE-DATE.jpg

Build View

  • Drag and Drop Year Difference from Measure to Dimension, then drop to Column Shelf
  • Drag and Drop First Purchase Date to Row Shelf 
    • Right-Click on First Purchase Date -> Select Month
    • Right-Click on First Purchase Date -> Select Discrete
2022_06_COHORT-ANALYSIS_PURCHASE-DATE.jpg
  • Drag and Drop Customer ID to Color in the Marks Pane
    • Right Click on Customer ID in Marks Pane -> Select Measure -> Select Count(Distinct)
  • Drag and Drop Customer ID to Text in the Marks Pane
    • Right Click on Customer ID in Marks Pane -> Select Measure -> Select Count(Distinct)
2022_06_cohort-analysis_customer-id_count-distinct.jpg

We can check the number of distinct customers who came back to buy a product after their first purchase from the above figure.

Note: Here, Null indicates that the customer never returns to repurchase the product.

Highlight Actions in Tableau
Dimension and Measure in Tableau
How to Create Group in Tableau

Additional Resource

Removing Null

  • Drag and Drop Month Difference to Filters Pane
    • A filter dialog box will appear
    • Uncheck Null
    • Click OK
2022_06_cohort-analysis_uncheck-null.jpg

You will get the below visualization which doesn’t contain the Null Column.

2022_06_cohort-analysis_filter.jpg

Changing Count (distinct) to Percent of Total

Now we will change the distinct Count of customer id to the percentage of the total to get the customer’s retention rate every month.

  • Right-Click on CNTD(Customer ID) in marks pane -> Select Quick Table Calculation -> Select Percent of Total
2022_06_cohort-analysis_percent-of-total.jpg

Note: We have to do the same above step for both the CNTD(Customer ID) ), i.e., for both color and text).

Sort Data in Tableau
Data Aggregation in Tableau
Union in Tableau: Create, Rename and Remove

Conclusion

In this article, we had briefly covered how to do cohort analysis in tableau with the help of a sample super store data.

Hope this article, will help you in your Data Analytics journey.

Top Trending Articles:

Data Analyst Interview Questions | Data Science Interview Questions | Machine Learning Applications | Big Data vs Machine Learning | Data Scientist vs Data Analyst | How to Become a Data Analyst | Data Science vs. Big Data vs. Data Analytics | What is Data Science | What is a Data Scientist | What is Data Analyst

About the Author
author-image
Vikram Singh
Assistant Manager - Content

Vikram has a Postgraduate degree in Applied Mathematics, with a keen interest in Data Science and Machine Learning. He has experience of 2+ years in content creation in Mathematics, Statistics, Data Science, and Mac... Read Full Bio