Understanding customer retention is critical for any subscription-based business. Before we dive into the Tableau calculated fields, use this calculator to verify your logic and see how the math works.
Customer Churn Calculator
Calculated Churn Rate:
0.00%
How to Calculate Churn Rate in Tableau
Calculating churn in Tableau requires comparing active customers across two different time slices. There are two primary ways to approach this: using Fixed LOD expressions or Table Calculations.
Method 1: The Simple Retention Formula
The most basic formula for churn is the percentage of customers who were active in the previous period but are not active in the current period.
// Step 1: Count Customers at Start of Period
COUNTD(IF [Period] = "Previous" THEN [Customer ID] END)
// Step 2: Count Lost Customers
COUNTD(IF [Is Churned] = TRUE THEN [Customer ID] END)
Method 2: Using Calculated Fields (Advanced)
To create a dynamic churn dashboard, follow these steps:
Create a "Last Purchase Date" per Customer:
{ FIXED [Customer ID] : MAX([Order Date]) }
Determine if the Customer is Churned:
IF DATEDIFF('month', [Last Purchase Date], TODAY()) > 3 THEN 1 ELSE 0 END
(This flags users who haven't purchased in 3 months as churned).
Calculate Churn Rate:
SUM([Is Churned]) / COUNTD([Customer ID])
Realistic Example Calculation
Let's look at a SaaS business scenario over a 30-day window:
Metric
Value
Description
Starting Customers (Jan 1)
5,000
Total active subscribers at the beginning.
Cancellations (Jan 1 – Jan 31)
250
Users who ended their subscription.
New Signups
400
Note: New signups are ignored in basic churn rate math.
Churn Rate
5.00%
(250 / 5,000) * 100
Key Tableau Functions to Use
COUNTD([User ID]): Always use Count Distinct to avoid duplicating users who have multiple transactions.
ZN(): Use the Zero Null function to handle periods where you might have 0 churned customers.
LOOKUP(): Use this if you want to compare the customer count of the current row to the previous row in a table.
SEO Tip: When building your Tableau dashboard, ensure your "Churn Rate" measure is formatted as a Percentage with at least two decimal places. This ensures high-level stakeholders can see incremental changes in retention health.
function calculateChurn() {
var start = document.getElementById('startingCustomers').value;
var lost = document.getElementById('lostCustomers').value;
var startVal = parseFloat(start);
var lostVal = parseFloat(lost);
if (isNaN(startVal) || isNaN(lostVal)) {
alert("Please enter valid numerical values.");
return;
}
if (startVal 100) {
document.getElementById('churnOutput').innerText = churnRate.toFixed(2) + "% (Warning: Exceeds 100%)";
} else {
document.getElementById('churnOutput').innerText = churnRate.toFixed(2) + "%";
}
}