Use case

How to Analyze Unit Economics Using AI

Compare revenue, variable costs, and contribution by product and customer segment using the governed metrics in your Cube deployment.

  • Define the economic unit and included costs
  • Compare contribution by product and customer segment
  • Reconcile per-unit and portfolio results over time

What is unit economics analysis with AI?

Unit economics analysis measures revenue and variable costs for a defined unit, such as a customer, transaction, or product-account subscription. It shows how much contribution profit remains after the included variable costs, then compares that result across products, customer segments, and periods. Finance, product, RevOps, and data teams can use an AI agent to inspect those modeled metrics and summarize where the numbers changed.

The example on this page uses a product-account subscription as its unit. An account using two products appears once in each product group, so the product-account total is not a count of unique customers. The review describes historical results; it does not calculate customer lifetime value, acquisition payback, full operating profit, or the cause of a change.

Cube is the semantic layer for AI. An existing Cube deployment can give people and AI agents governed, reliable access to business metrics; the model still needs to define the unit, revenue, variable costs, allocations, and historical segment membership. The workflow below uses those definitions rather than asking an agent to infer them from raw data.

Define the unit and cost basis

Use one reporting currency and complete periods in the model's reporting time zone. The examples below are fictional; a real review must use the approved metric and allocation definitions in your deployment.

Illustrative inputs for a fictional June and July 2026 review
MetricIllustrative example
Reporting windowJune 1–30 and July 1–31, 2026 inclusive, in the model’s reporting time zone.
Analysis unitA product-account subscription; an account using two products counts once in each product group.
Eligible units155 product-account subscriptions in June and 166 in July, split by product and customer segment.
RevenueJune: $80,000. July: $86,200, using one currency and the same modeled net-revenue definition.
Variable costsJune: $30,900. July: $34,420, including the fictional example’s variable cloud, payment-processing, and allocated support costs.
Contribution profit and marginJuly: $86,200 revenue − $34,420 variable costs = $51,780 profit; $51,780 ÷ $86,200 = 60.1% margin.
Support allocationAllocate support costs by active paying product-account subscriptions in each month; keep the same rule in both periods.
The Prompt

Copy. Paste. Run your unit economics review.

Select the intended Cube deployment, then run this read-only review with 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 unit economics review using my connected Cube deployment. Use read-only analytics requests and do not return customer or account identifiers. DEFINITIONSInspect the model before querying. Report the approved revenue and variable-cost metrics, contribution-profit and contribution-margin formulas, analysis-unit grain, eligible-unit rule, product and customer-segment dimensions, currency, reporting time zone, and effective dates for segment membership. State how direct and allocated costs are treated. Follow the modeled definitions. If a metric, allocation, unit grain, historical segment assignment, or required input is missing or ambiguous, report the gap instead of inventing a proxy or result. ANALYSIS1. Review the last three complete calendar months available in the model. State each inclusive start and end date and the reporting time zone. Exclude an incomplete current month. Use product and customer-segment membership effective in each period when modeled; disclose if only current assignments are available.2. For each month and product-by-customer-segment group, report eligible product-account units, revenue, variable costs, contribution profit, and contribution margin. Show the numerator and denominator for every rate. Calculate profit per unit only when its numerator and denominator use the same modeled grain. Apply the model’s rules for discounts, refunds, credits, and excluded records; do not combine currencies without an approved conversion rule.3. Reconcile grouped units and amounts to monthly totals where the model grain permits. Calculate portfolio contribution margin from total contribution profit divided by total revenue. Do not average segment or monthly rates. Show unassigned groups, missing values, and any reconciliation gap.4. Compare the same product and segment across periods. Report changes in unit counts, profit per unit, and contribution margin in percentage points. Separate changes in unit cost, revenue per unit, and product or segment mix from explanations about why they changed.5. Check for small groups, zero or changing denominators, duplicate joins, incomplete periods, missing segment history, and allocated costs that do not reconcile. Keep identifiers private. OUTPUTReturn the metric definitions, allocation rules, currency and time zone, exact date filters, a monthly totals table, a product-by-segment table, reconciliations, and a concise interpretation. Distinguish observed patterns from hypotheses and list follow-up checks. Do not forecast results, infer lifetime value or acquisition payback, or claim causal drivers without supporting evidence.

How it works

1

Set the unit and reporting scope

Confirm whether the modeled unit is a customer, transaction, or product-account subscription. Check complete date ranges, reporting time zone, product and segment history, currency, and the approved revenue and variable-cost definitions before comparing groups.

2

Reconcile contribution by group

For each product and customer segment, compare eligible units, revenue, included variable costs, contribution profit, and margin. Calculate per-unit profit only at a matching grain, then calculate the portfolio margin from pooled profit and revenue rather than averaging segment percentages.

3

Explain the observed change

Compare the same groups over time and inspect unit counts, revenue per unit, variable cost per unit, and mix. Treat a pattern as a place to investigate; check the source data and business context before attributing a cause.

Compare contribution across periods and segments

The two-point trend and product-segment table use fictional June and July 2026 values. The portfolio margin is calculated from total contribution profit divided by total revenue.

Worked example: fictional unit economics by product and customer segment in July 2026
Product / segmentProduct-account unitsRevenueVariable costsContribution profitContribution margin
Core / SMB84$25,200$11,760$13,44053.3%
Core / Mid-market22$33,000$9,900$23,10070.0%
Analytics / SMB44$8,800$5,720$3,08035.0%
Analytics / Mid-market16$19,200$7,040$12,16063.3%
Total166$86,200$34,420$51,78060.1%
  • In July, contribution profit is $86,200 − $34,420 = $51,780 and portfolio margin is $51,780 ÷ $86,200 = 60.1%. June is $49,100 ÷ $80,000 = 61.4%, a decrease of 1.3 percentage points. The portfolio rate uses pooled totals, not an average of group margins.
  • From June to July, revenue rose by $6,200, or 7.8%, while variable costs rose by $3,520, or 11.4%. Contribution profit rose by $2,680, or 5.5%; these are observed changes in the fictional data, not evidence of a cause.
  • Analytics / SMB margin moved from $3,200 ÷ $8,000 = 40.0% in June to $3,080 ÷ $8,800 = 35.0% in July. Revenue per unit stayed at $200, while variable cost per unit rose from $120 to $130; profit per unit fell from $80 to $70 and total group profit fell by $120 even as units increased from 40 to 44. These figures show where to investigate, not why costs changed.
  • Core / Mid-market margin stayed at 70.0%; contribution profit increased from $21,000 in June to $23,100 in July as units rose from 20 to 22. This comparison describes the figures but does not establish what caused the increase.
  • The 166 July units are product-account subscriptions, not unique customers. An account using both products appears in both product groups, so do not interpret the sum as 166 distinct accounts.

All figures in the page and images are fictional illustrations, not executed queries, customer results, benchmarks, or predictions. The example includes only the stated variable costs and support allocation; it excludes fixed overhead, tax, financing, and acquisition costs. Real results depend on approved metric definitions, cost coverage, segment history, and permissions in the Cube deployment.

Frequently Asked Questions

Unit economics analysis compares revenue and the costs attributed to a defined unit, such as a customer, transaction, or product-account subscription. State the unit and period first; otherwise revenue per unit and contribution profit can use mismatched denominators.

Try Cube for free