How to Analyze Customer Segments Using AI
Compare revenue and product use across explicit customer segments with an AI agent, using the definitions in your Cube model.
- Set explicit segment rules and a customer population
- Compare revenue and product use by segment
- Check counts, denominators, and missing data
What is customer segmentation analysis with AI?
Product, data, and revenue teams use customer segmentation analysis to group a defined population by explicit attributes or behavior, then compare outcomes such as revenue, retention, or product use. Common rules use plan, region, lifecycle stage, or recency, frequency, and monetary-value (RFM) tiers. This example compares plan segments; it does not discover groups through machine learning.
Cube is the semantic layer for AI: an agent can work with the same governed metrics and dimensions as the people reviewing the results. This workflow holds each customer's plan fixed at the start of the period and describes what happened afterward. Segment differences can guide a follow-up question, but they do not explain causes or predict an individual customer's behavior.
Define the population before comparing segments
Use a distinct customer grain, an approved segment rule, and a fixed reporting window. The fictional example assigns plan on April 1 and measures outcomes only for those opening customers.
| Metric | Illustrative example |
|---|---|
| Reporting window | 2026-04-01 inclusive through 2026-07-01 exclusive, in the model time zone. |
| Opening population | 600 eligible customers active on April 1; customers added after that date are excluded. |
| Segment assignment | Starter, Growth, or Enterprise plan recorded on April 1; keep that assignment for the full quarter. |
| Revenue per customer | Starter: $360,000 Q2 revenue / 300 opening customers = $1,200. |
| Active customer rate | Starter: 135 of 300 opening customers had at least one qualifying session in Q2 = 45.0%. |
Copy. Paste. Run your segment analysis.
Connect to Cube via MCP or our CLI, then run this prompt in your preferred agent.
Start with a Cube deployment connected to your data and a model containing the metrics you want to analyze.
Connect over MCP
Connect your agent to your existing Cube deployment and sign in through OAuth.
https://cubecloud.dev/mcp
Complete OAuth in your agent to connect your Cube account.
Use your default deployment or select another one available to your account.
Connect with CLI
Install the Cube CLI and sign in from a terminal-capable agent.
curl -fsSL https://raw.githubusercontent.com/cube-js/cube/master/install-cli.sh | sh
cube login --url https://TENANT.cubecloud.dev
cube spec --json
02Run this prompt in your agent
Choose your agent and copy the prompt below.
Use the Cube MCP server connected in Codex and select the intended deployment. Run read-only analytics queries. Analyze customer segments using my connected Cube deployment. Use read-only requests, return aggregated results only, and do not expose customer names, identifiers, or personal data. DEFINITIONSInspect the unique customer grain, opening-population rule, available segment dimensions and their effective dates, approved revenue metric and currency, qualifying product-usage event, and model time zone. Use documented segment rules or existing modeled dimensions. Do not invent a segment definition or create machine-learning clusters. If an input or definition is missing, state the gap. DATE WINDOWUse the most recently completed calendar quarter in the model time zone. Include the quarter's first day and exclude the first day of the next quarter. State the exact start date, exclusive end date, and time zone. If the model time zone is unavailable, say so rather than guessing. POPULATION AND SEGMENTS1. Count distinct eligible customers in the opening population as of the quarter start. Assign each customer using the segment value effective on that date, and hold membership fixed through the period.2. Show unassigned, excluded, and overlapping customers separately. Do not silently drop them or add overlapping segment counts as if they were unique customers. Reconcile segment counts to the eligible total when the definitions allow it. CALCULATIONS1. For each segment, report opening customers and revenue earned during the quarter by those same customers. Calculate revenue per customer as segment revenue divided by distinct opening customers. Exclude customers acquired after the quarter starts from both the segment population and its revenue comparison.2. If the approved usage event exists, calculate active-customer rate as distinct opening customers with at least one such event during the quarter divided by opening customers in that segment. Show the numerator and denominator. Do not substitute sessions, events, or logins for the approved definition.3. If an approved retention metric is requested and available, show its own definition, numerator, and denominator separately from product activity.4. Recalculate overall revenue per customer and active-customer rate from pooled totals. Do not average segment rates or per-customer values. Compare counts alongside percentages and flag small groups or incomplete coverage. MISSING DATA AND OUTPUTKeep missing segment values visible as unassigned, and report missing revenue or usage coverage rather than treating it as zero. Return the date window, metric definitions, a segment table with counts and denominators, reconciled totals, exclusions, and a concise interpretation. Separate observed differences from hypotheses about causes. Recommend checks that could test those hypotheses; do not claim causation or predict future customer behavior from these historical results.
How it works
Fix the customer and segment definitions
Confirm the distinct customer key, opening eligibility, segment rule, effective date, reporting time zone, and the quarter window. Keep membership fixed at the start date or explain why the model cannot support that comparison.
Compare outcomes with their denominators
Show opening customer counts, revenue per customer, and active-customer rates by segment. Recompute overall values from pooled counts and revenue, and make unassigned or incomplete records visible.
Validate the pattern before acting
Check segment size, metric definitions, and reconciliation before choosing a follow-up. A difference in revenue or activity is descriptive; review other factors before proposing an explanation or intervention.
Compare revenue and use across customer segments
This chart uses fictional Q2 2026 values to compare revenue by plan and customers with a qualifying session. Plan membership is fixed on April 1; these figures are illustrative, not customer results or predictions.
| Plan at period start | Opening customers | Q2 revenue | Revenue per customer | Active in Q2 |
|---|---|---|---|---|
| Starter | 300 | $360,000 | $1,200 | 135 / 300 (45.0%) |
| Growth | 200 | $480,000 | $2,400 | 130 / 200 (65.0%) |
| Enterprise | 100 | $360,000 | $3,600 | 80 / 100 (80.0%) |
| Total | 600 | $1,200,000 | $2,000 | 345 / 600 (57.5%) |
- The 600 opening customers generated $1,200,000 in Q2 revenue, or $2,000 per opening customer. The total is calculated from pooled revenue and customers, not an average of the plan values.
- Growth accounts for $480,000 / $1,200,000 = 40.0% of revenue and 200 / 600 = 33.3% of the opening population. Its $2,400 per-customer revenue is 20% above the $2,000 overall value.
- Active-customer rates range from 45.0% in Starter to 80.0% in Enterprise, a difference of 35 percentage points. These fictional rates describe this period; they do not show that plan caused the difference.
All values in this table and image are fictional and hand-calculated for illustration, not executed queries, customer results, a benchmark, or a prediction. Segment differences are descriptive; actual results depend on the customer grain, plan history, revenue definition, usage event, and data coverage in your deployment.