SaaS Revenue Analytics with SQL: from implementation to decision
A complete saas revenue analytics with sql measurement loop connects one owned workflow, a bounded event contract, a controlled fixture, and a question someone can act on.
- 1
Set the boundary
Document the source of truth for subscriptions, invoices, entitlements, and account identity.
- 2
Capture the outcome
Begin with subscription_revenue_moved, invoice_payment_completed, invoice_payment_failed and document the grain of each event.
- 3
Prove the rows
Join reviewed revenue movements to product outcomes only after validating account identity and cohort windows.
- 4
Make the decision
How much MRR came from new, expansion, contraction, churn, and reactivation movements?
Scope and neighboring use cases
Choose this page for the right measurement boundary
- Use this page for subscription revenue movements and revenue retention, not raw payment volume alone.
- Use usage-based billing analytics for meter, quota, entitlement, and invoice-input correctness.
- Use product analytics and retention for behavioral cohorts that do not require an accounting-style revenue reconciliation.
Agent prompt
Paste this into your coding agent
Replace YOUR_API_KEY after signup, then ask the agent to run the product flow and verify the first events.
SaaS Revenue Analytics with SQL setup prompt
Instrument SaaS revenue analytics with Telemetry.
Use /skill.md and this Telemetry API key: YOUR_API_KEY
Create immutable subscription_revenue_moved events for new, expansion, contraction, churn, and reactivation movements. Include account_id, subscription_id, movement_type, prior_mrr_minor, new_mrr_minor, movement_mrr_minor, currency, effective_at, plan, billing_interval, reason_category, source_event_id, and schema_version.
Add invoice payment and entitlement outcome events with stable provider identifiers so a closed period can be reconciled without counting webhook retries twice. Connect product outcomes using the same approved account_id.
Create SQL for MRR movement, gross and net revenue retention, payment-failure recovery, expansion by activation cohort, and revenue at risk after reliability incidents.
Keep money in integer minor units, preserve currency, document the reporting timezone and cohort window, and do not log card data, invoice PDFs, customer names, email addresses, or unrestricted provider payloads.Setup steps
- 1Document the source of truth for subscriptions, invoices, entitlements, and account identity.
- 2Emit immutable revenue-movement events with currency, effective time, prior value, new value, and reason category.
- 3Reconcile a closed billing period against the provider export before publishing MRR or retention metrics.
- 4Join reviewed revenue movements to product outcomes only after validating account identity and cohort windows.
Events to capture
Questions unlocked
- How much MRR came from new, expansion, contraction, churn, and reactivation movements?
- Which activation and adoption patterns precede retained or expanded revenue?
- Which failed payments, reliability incidents, or entitlement changes put recurring revenue at risk?
Event schema starting points
Event contracts for this workflow
Review the row grain, emit boundary, required types, privacy classes, example payload, and validation checklist before adapting a query or snippet to production.
user_signed_up
One accepted signup per user and account.
Inspect contractproduct_milestone_completed
One completed milestone per actor, account, and occurrence.
Inspect contractinvoice_payment_completed
One terminal payment attempt.
Inspect contractRelated product capability
Continue this workflow in Dashboards
Turn a validated product or revenue query into a focused decision surface.
Related SQL recipes
Answer the next question with SQL
Run the query against the structured fields from this workflow, inspect the example result, and turn a useful answer into a dashboard or alert.
Calculate Monthly Recurring Revenue Movement
What caused recurring revenue to grow or shrink each month?
Open recipeCalculate Net and Gross Revenue Retention
How much starting recurring revenue was retained before and after expansion?
Open recipeMeasure Payment-Failure Recovery
Which payment failures recover, and how much revenue remains at risk?
Open recipeFind Features Used Before Upgrade
Which features are most commonly adopted before an account upgrades?
Open recipeBuild a Signup-to-Activation Funnel in SQL
Where do new users leave before reaching first value?
Open recipeMeasure Churn and Reactivation by Cohort
How many accounts churned, stayed active, or returned this month?
Open recipeCustomer evidence
Related workflows described by customers
Next step
Create the API key your agent will use
The free plan is enough to run the prompt, send test events, and review the first dashboard.
Related pages
Usage-Based Billing Analytics
Build a defensible usage ledger, quota dashboard, overage workflow, and billing reconciliation from idempotent structured events.
Open pageCursor Telemetry Setup
A copyable setup prompt for adding event tables, funnel tracking, and dashboards from inside Cursor.
Open pageProduct Analytics for Retention
Use agent-installed structured events to learn which early actions create returning users and revenue-ready teams.
Open page