What is a cohort analysis?

Cohort Analysis can be thought of as a study of the actions of a specific cohort through time. A cohort can be defined as a group of people who are divided into time periods and share common traits. In this sort of analysis, actionable metrics play a major role. Actionable metrics are those that help to enhance a product or sales, such as the rate of conversion of a specific product over time, or the rate of retention of customers who signed up during a sale.

Let’s dive right into see how we can do a cohort analysis in Tableau. Let’s find find out the loyalty of customers.

How can you do the cohort analysis?

In order to demonstrate how to do the cohort analysis in Tableau, we use the Sample-Superstore data. We are going to measure the return purchase by quarter of the year.

Step 1: Finding the Acquisition Quarter

To begin the cohort analysis, we need to determine the acquisition quarter for each customer. We can achieve this by using the following Tableau calculation:

{FIXED [Customer Name]: DATETRUNC(‘quarter’, MIN([Order Date]))}

This calculation fixes the customer name and identifies the minimum order date to determine the acquisition quarter.

Step 2: Calculating the Quarters Since Birth

Next, we need to calculate the number of quarters that have passed since the acquisition quarter. We can accomplish this using the following Tableau calculation:

DATEDIFF(‘quarter’, [Acquisition Quarter], DATETRUNC(‘month’, [Order Date]))

This calculation computes the difference in quarters between the acquisition quarter and the truncated month of the order date.

Step 3: Finding the number of customers for each acquisition quarter

The following FIXED level of detail expression computes the number of customers per acquisition quarter:

{FIXED [Acquisition Quarter]: COUNTD([Customer Name])}

This level of detail expression, named [no of customers].

Step 4: Creating the Visualization

Now, let’s create the visualization to showcase the cohort analysis. Follow these steps:

  1. Drag the ” Acquisition Quarter” field to the rows shelf.
  2. Click on the “+” sign next to the “Year” field on the columns shelf and select “Quarter.” Ensure that it is set to discrete.
  3. Move the “Quarters since birth” (dimension) to the columns shelf.
  4. From the marks card, select the “Square” shape for the visualization.
  5. “No of customers”, is then placed on Text to show total customers per acquisition quarter.
  6. Finally, we place the [no of customers], Color, to easily track customer acquisitions.

Voila! You have successfully created a cohort analysis visualization for the Sample Superstore dataset in Tableau.

Cohort analysis is a valuable technique for understanding customer retention, behavior, and lifetime value. With Tableau’s powerful data visualization capabilities, conducting cohort analysis becomes seamless. By following the steps outlined in this article, you can gain insights into customer cohorts and identify trends that can inform your business strategies. Start exploring the world of cohort analysis in Tableau today and unlock the potential of your data.


Image by Gerd Altmann from Pixabay

The Data School
Author: The Data School