Cohort Analysis in Tableau

Cohort Analysis in Tableau

4 mins read1.3K Views Comment
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

Free
3 hours
Free
21 hours
Free
5 hours
Free
– / –
₹39.54 K
2 hours
– / –
– / –
Free
19 hours
₹8.4 K
3 weeks
Free
2 hours
– / –
– / –

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 Word Cloud in Tableau
In this article, we will briefly discuss about word cloud in tableau and how to create word cloud with an example.
How to Create a Forecast in Tableau
How to Create a Forecast in Tableau
In this article, we will discuss what is forecasting, how does forecasting works in tableau, data requirement and constraints and finally how to create forecasting in tableau.
How to Create Hierarchies in Tableau
How to Create Hierarchies in Tableau
In this article, we will discuss hierarchies in tableau, how to create and remove hierarchies in tableau with examples.

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
Highlight Actions in Tableau
In this article, we will briefly discuss highlighting actions in tableau and different methods to highlight the data with examples.
Dimension and Measure in Tableau
Dimension and Measure in Tableau
Tableau supports seven different data types and it tableau automatically assigns a data type and role to each column.
In this article, we will discuss one of the important concepts...read more
How to Create Group in Tableau
How to Create Group in Tableau
In this article, we will briefly discuss about groups in tableau, how to create groups and finally what are the differences between tableau groups and tableau sets. In this article,...read more

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
Sort Data in Tableau
In this article, we will discuss about sorting and different methods how to sort data in tableau briefly with examples.
Data Aggregation in Tableau
Data Aggregation in Tableau
In this article, we discussed different aggregation functions in tableau, how to change the aggregation of a measure in a view and how to disaggregate the data. In this article,...read more
Union in Tableau: Create, Rename and Remove
Union in Tableau: Create, Rename and Remove
In this article, we have discuss union in tableau, how to create it manually and automatically using wildcards.

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