Use case

How to Analyze Customer Retention Using AI

Review customer and revenue retention, compare opening-period segments, and check the counts behind each rate with an AI agent connected to your Cube deployment.

  • Define the opening population and period
  • Separate customer, gross revenue, and net revenue retention
  • Compare segments without averaging their rates

What is customer retention analysis with AI?

Customer retention analysis measures the share of customers active at the start of a defined period who meet the model's active rule at its end. It can also compare gross and net revenue retention for the same opening customer population. An AI agent can retrieve modeled metrics, show their definitions, and organize results by period or by a segment recorded at period start.

This workflow reviews historical metrics; it does not predict renewals or churn. A retention rate describes the selected population and dates, but does not explain why customers stay or leave. Keep calendar-period retention separate from signup-cohort analysis, which measures activity at equal tenure after a shared start event.

Set the retention period and denominator

Use the model's approved customer and revenue definitions. Fix the start and end dates, timezone, and segment value at period start before comparing results.

Fictional inputs for a March 2026 retention review
MetricIllustrative example
Review windowMarch 1–31, 2026, UTC; 500 customers active at the start and 450 of those customers active at month end.
Customer retention450 / 500 = 90.0%; customers added during March are excluded from both counts.
Gross revenue retentionOpening-cohort MRR: $500,000; $50,000 lost to cancellation or contraction leaves $450,000 / $500,000 = 90.0%; expansion and new customers are excluded.
Net revenue retention$450,000 after cancellation or contraction + $75,000 expansion = $525,000; $525,000 / $500,000 = 105.0%; new customers are excluded.
SegmentationAssign plan at March 1: Starter has 280 starting customers and Growth has 220.
The Prompt

Copy. Paste. Run your retention review.

Connect to Cube via MCP or our CLI, then run the prompt below in your preferred agent.

Start with a Cube deployment connected to your data and a model containing the metrics you want to analyze.

01Connect over MCP

Connect over MCP

Connect your agent to your existing Cube deployment and sign in through OAuth.

MCP endpoint
https://cubecloud.dev/mcp
Sign in to Cube

Complete OAuth in your agent to connect your Cube account.

Choose a deployment

Use your default deployment or select another one available to your account.

Read the MCP setup docs
01Connect with CLI

Connect with CLI

Install the Cube CLI and sign in from a terminal-capable agent.

Install the CLI
curl -fsSL https://raw.githubusercontent.com/cube-js/cube/master/install-cli.sh | sh
Log in (replace TENANT with your account name)
cube login --url https://TENANT.cubecloud.dev
Inspect API operations
cube spec --json
Read the CLI docs

02Run this prompt in your agent

Choose your agent and copy the prompt below.

Prompt for Codex
Use the Cube MCP server connected in Codex and select the intended deployment. Run read-only analytics queries. Run a historical customer and revenue retention review using my connected Cube deployment.Use read-only requests and do not return customer identifiers. DEFINITIONSInspect the semantic model and report its approved customer grain, active-statusrule, revenue metrics, timezone, and available segment fields. State thenumerator and denominator for every reported rate. If a required metric,field, or date is missing, explain the gap instead of inventing a result. Use the model's approved definition when one exists. For customer retention,the default is distinct customers active at both period start and period enddivided by distinct customers active at period start. State the exact datesand timezone. If the approved metric uses a different rule, describe it anduse that approved metric rather than silently redefining it. Gross revenue retention (GRR) is opening recurring revenue for the startingcustomer population, less cancellations and contraction, divided by openingrecurring revenue. Exclude expansion and new customers. Net revenueretention (NRR) uses that same starting population and denominator, includesexpansion, and excludes revenue from new customers. Use approved modeledGRR or NRR metrics; do not reconstruct a missing metric from raw fields. ANALYSIS1. Review the last three complete calendar months with available data. State   each exact start and end date, timezone, and whether source data is   complete. Exclude an incomplete current month.2. For each month, show the opening customer count, customers still active   at month end, and customer retention rate. Where approved revenue metrics   exist, show opening recurring revenue and the GRR and NRR numerators,   denominators, and rates. Compare period changes in percentage points.3. Compare modeled segments such as plan or region using membership at the   period start. Show each segment's counts or revenue and rates, flag small   samples, and mark missing data as unavailable. Calculate overall rates   from summed numerators and denominators; never average segment rates.4. Explain customer grain, status and reactivation rules, filters, date   boundaries, and the metric definitions used. Keep calendar-period results   separate from signup-cohort retention at matched tenure.5. Separate observed results from hypotheses about causes. Suggest follow-up   checks, but do not claim causation or predict individual renewals. OUTPUTReturn the definitions, result tables, query context, and a conciseinterpretation. Keep customer identifiers private. State any gaps or smallsamples clearly; do not fill missing metrics with estimates.

How it works

1

Fix the starting population

Confirm the customer status rule, exact period boundaries, timezone, and modeled customer grain. Assign plan or region at the period start so a later change does not rewrite the segment.

2

Reconcile customer and revenue rates

Check each numerator against its denominator. Keep customer counts separate from recurring revenue, exclude expansion from GRR, include it in NRR, and calculate totals from the underlying counts and revenue rather than averaged segment rates.

3

Investigate the differences

Compare periods and modeled segments, then check the underlying activity or billing history for a pattern worth testing. A segment difference is an observation, not proof of why customers stayed or left.

Read customer and revenue retention together

The chart uses fictional March 2026 values. Each plan’s gross and net revenue retention divides retained recurring revenue by that plan’s opening MRR; customer retention is counted separately.

Worked example: fictional customer and revenue retention, March 2026
Plan at March 1Starting customersActive March 31Customer retentionOpening MRRGRR retained MRR / rateNRR retained MRR / rate
Starter280252252 / 280 = 90.0%$180,000$160,000 / $180,000 = 88.9%$182,500 / $180,000 = 101.4%
Growth220198198 / 220 = 90.0%$320,000$290,000 / $320,000 = 90.6%$342,500 / $320,000 = 107.0%
Total500450450 / 500 = 90.0%$500,000$450,000 / $500,000 = 90.0%$525,000 / $500,000 = 105.0%
  • The total customer retention rate is 450 divided by 500, or 90.0%. The two plan counts sum to the total; customers acquired during March are outside the opening population.
  • GRR is $450,000 divided by $500,000, or 90.0%, after $50,000 in cancellations and contraction. NRR adds $75,000 in expansion to reach $525,000, or 105.0%; new-customer revenue is excluded from both metrics.
  • Starter and Growth each retain 90.0% of their opening customers, while their revenue rates differ. These descriptive results identify where to investigate; they do not establish the cause of expansion or contraction.

This worked example and the sample image use fictional values, not executed queries, a customer result, a benchmark, or a prediction. Real results depend on the model's metric and status definitions, billing history, and complete source data; retention rates do not explain causes or forecast renewals.

Frequently Asked Questions

Divide the distinct customers from the opening population who are active at period end by the distinct customers active at period start. State the active-status rule and the exact dates. In the fictional March example, 450 of 500 opening customers remain active at month end, or 90.0%.

Try Cube for free