MIP Logo

15 Examples of Tableau LOD – Cohort Analysis

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here

This blog is inspired by blog: Top 15 Tableau LOD Expressions (Practical Examples).

Tableau LOD (Level of Detail) Expression is one of the most powerful tools to achieve amazing results in building dashboards. In this series of blogs, we will walk through 15 different use cases to demonstrate the usage of LOD expression.

Cohort analysis

In this blog, we will demonstrate a simple example of customer cohort analysis with Tableau LOD.

In this example, our goal is:  if longer tenured customers contribute a larger percentage of sales, we could do the following. We will use Superstore dataset to this example and the steps are as followed:

  1. Let’s create the Customer Cohort: to achieve this, we need to think about how to define the customer cohort. In this example, we separate the cohort based on the first time a customer made an order. So we need to create a calculated field named Customer Cohort with the script shown in below image:

2.Viz structure construction: we need to construct the basic structure of the visualization we want to achieve. We can drag Order Date to Columns (discrete year of “Order Date” field) and the total of sales (SUM of “Sales” field) to rows.

3. Color the Cohort: if we want to know for each year of the order date, how much sales is from each customer cohort, we could color the bar chart by the calculated field we created, which is “Customer Cohort”. The set-up in Tableau is as shown in below image:

4. Analyze the proportion: we want to further know the proportion of the sales each customer cohort contributed to, so we could add another set of bars to visualize the percentage. Let’s duplicate the sheet and add “Percentage of Total” to table calculation. The setting is shown in below image.
5. Finish the work in a dashboard: finally let’s put the two sheet we make together and format a little bit to add some readability and pretty to it.

An example dashboard is published in Tableau public as well:

Share this post