Sign in

Blog · How-to guides

Cohort analysis in Tableau: retention by customer age

Build a Tableau retention view from prepared customer and activity exports. Fix cohort membership, compare equal customer ages, and prove the counts before reading the colors.

The short answerCohort analysis in Tableau groups customers by a fixed entry date and compares their later activity at the same age. Prepare customer membership, activity counts, and completed observation windows before building the view. Divide retained customers by the original cohort size, leave immature cells blank, and reconcile each displayed count to the underlying customer rows.

Cohort analysis in Tableau compares fixed groups of customers at equal ages, such as repeat purchasing in the month after their first order. Build the membership and observation checks before the colored table. Otherwise, missing future months can look like lost customers.

Define membership before building the view

Use a customer register with one row per account, its first qualifying purchase date, and a stable identifier. Bring a separate activity export with customer identifier and qualifying order date. Establish whether cancellations and test accounts belong before counting anything.

For this example, a US business supplies distributor defines entry as the first completed purchase. Age zero is the entry calendar month; age one is the next calendar month. Retention means at least one completed purchase within the specified age month. It does not require an uninterrupted purchasing streak.

The historical entry date must come from the complete customer register. The first order visible in a recently filtered export might be a repeat order. Keep the underlying cohort definition alongside the report, including the reporting cutoff and business timezone.

Retention at age n = Distinct original cohort members purchasing in completed age month n / Original cohort members

Prepare customer-age rows in Excel

Make one row per customer per age being measured, including customers with no later orders. Put customer ID in A, first purchase date in B, and age in C. In this example, L1 contains March 31, 2026, meaning data is complete through that day's end.

Calculate the age month's start in D2, its end in E2, and maturity in F2:

=EDATE(DATE(YEAR(B2),MONTH(B2),1),C2)
=EOMONTH(D2,0)
=--(E2<=$L$1)

With customer IDs in Activity!A2:A1000 and completed order dates in Activity!B2:B1000, calculate the return flag in G2:

=IF(F2=0,"",--(COUNTIFS(Activity!$A$2:$A$1000,A2,Activity!$B$2:$B$1000,">="&D2,Activity!$B$2:$B$1000,"<"&EDATE(D2,1))>0))

Microsoft documents COUNTIFS for matching multiple criteria. Testing for a positive count gives one customer flag even with several orders. Extend the ranges to cover the full export. The existing Excel retention-table guide covers the broader spreadsheet layout.

Work the customer counts before the chart

These are the complete membership and activity flags for the distributor. A dash marks a future window, not an observed failure.

Customer First purchase Age-one month Age-one return Age-two month Age-two return
A January 5, 2026 February 1 March 1
B January 11, 2026 February 1 March 0
C January 22, 2026 February 0 March 0
D February 3, 2026 March 1 April —
E February 18, 2026 March 0 April —

Summarize the prepared rows into one row per cohort and age:

Entry cohort Age Original members Mature members Retained customers Retention
January 2026 1 3 3 2 66.7%
January 2026 2 3 3 1 33.3%
February 2026 1 2 2 1 50.0%
February 2026 2 2 0 — —

All displayed percentages are rounded to one decimal place. January age one is 2 / 3; January age two is 1 / 3; February age one is 1 / 2. February age two ends April 30, after the cutoff, so both its return count and percentage remain blank.

For summary columns C through F in the order shown above, calculate the rate in F2:

=IF(OR(D2<>C2,C2=0),"",E2/C2)

This formula requires the whole cohort's month to be complete. Keep original membership separate from maturity rather than quietly shrinking a cohort's denominator.

Display the checked summary in Tableau

Connect the prepared workbook through Microsoft Excel, select the workbook, and use its summary sheet. Tableau's Excel connection documentation describes that file workflow and distinguishes it from the Text file connector used for CSV files.

Place entry cohort on Rows and age as a discrete dimension on Columns. Set the Marks type to Square and place retention on Color and Label. This follows Tableau's documented highlight-table method. Keep the incomplete cell uncolored and display the cutoff in the worksheet title or caption.

Use the unrounded retention values. With exactly one summary row per cohort-age cell, a cell displays its prepared percentage without combining different cohorts. If you add segments, rebuild the summary at that grain and recalculate from counts; summing segment percentages is invalid.

Prove the view and interpret the comparison

At age one, the detail contains five original members and three returning customers. The pooled rate is 3 / 5 = 60.0%. The unweighted mean of the two cohort rates is 58.3%, so it does not reconcile to the customer count. Disable a displayed grand total unless it divides the matching retained and eligible counts.

Across age columns, membership repeats. Do not sum those repeated values into a customer total. At each age, retained customers must be no greater than mature members, and each customer must belong to one entry cohort.

January exceeds February at age one, but these small groups justify investigation rather than a verdict about onboarding. Read the retention-table interpretation guide for how rows, columns, and diagonals answer different questions. If membership depends on prior actions, use behavioral cohort analysis; for a product-event comparison, see Amplitude cohort analysis.

Where it goes wrong

  • Filtering out inactive customers. Membership must survive an empty activity window.
  • Calendar month confused with customer age. February is age one for January entrants and age zero for February entrants.
  • Future cells filled with zero. An unobserved month is not churn.
  • Orders counted as customers. Several orders still produce one return flag per customer-age row.

Covirage is not affiliated with Tableau or Microsoft.

Check your own cohort file in Covirage

Upload your customer register and prepared activity summary; Covirage maps the columns, and its tools compute and check membership, comparable ages, and retention figures. The external AI model explains the results with every figure traced to its rows. Create a free Covirage account and bring a sample of your own export.

See self-service analytics for the supporting business workflow.

Questions people ask

What should define a customer cohort in Tableau?

Use a business event that fixes membership, such as the first qualifying purchase. Preserve the customer identifier and original entry date even when later activity stops. A group defined by current activity answers a different question because its membership changes.

Why does the latest cohort have blank retention cells?

Its later observation windows have not finished. A blank means the outcome is not yet measurable; zero means a completed window had no qualifying return. Show the reporting cutoff so readers can distinguish these cases.

Can I average cohort retention percentages?

For an overall customer retention rate, divide total retained customers by total eligible cohort members at the same age. An unweighted average gives small and large cohorts equal influence and can differ from the customer-level result.

Does this method require a Tableau level-of-detail calculation?

No. This method starts with prepared membership and cohort-age summaries. It focuses on the business definitions and count checks. More complex workbook calculations may suit other source layouts, but they are outside this reporting workflow.