
Modeling Revenue Metrics
FreeCreate reusable revenue models with ease.
Free · Opens the source repo
What Modeling Revenue Metrics does
The Modeling Revenue Metrics skill enables users to construct robust revenue models, focusing on key metrics such as Monthly Recurring Revenue (MRR), Annual Recurring Revenue (ARR), gross revenue, and customer-specific revenue metrics. This skill is particularly useful for businesses that rely on subscription models or need to analyze revenue streams from various products or customer segments. By leveraging either PostHog's managed revenue analytics views or an external dbt project, users can efficiently model, define, and compute essential revenue metrics without dealing with raw payment data directly.
To get started, the skill guides users in identifying where their revenue data resides, whether from a payment platform like Stripe or through custom revenue events. It emphasizes the importance of using managed views instead of raw tables to ensure accurate revenue recognition and currency normalization. The skill also provides detailed instructions on how to handle common pitfalls, such as ensuring MRR is populated correctly and linking revenue data to individual customers or groups.
The skill includes a series of SQL recipes for both PostHog and dbt, allowing users to quickly implement revenue models tailored to their specific needs. With a focus on best practices, the skill helps users avoid common mistakes and ensures that the revenue models are built on a solid foundation. This makes it an essential tool for data analysts and developers working with revenue data who want to derive actionable insights from their payment and subscription data.
When to use it
Use this skill when you need to create or analyze revenue models based on subscription data, particularly in PostHog or dbt environments.
When not to use it
This skill may not be suitable for one-time payment models or businesses without a structured subscription system.
What you can build with it
Analyzing Subscription Revenue
Use this skill to derive insights from subscription data, modeling MRR and ARR to understand revenue trends.
Creating Custom Revenue Reports
Leverage the SQL recipes to generate tailored reports on revenue by customer, product, or cohort.
Handling Currency Variations
Utilize the currency normalization features to accurately report revenue across different currencies.
How to install Modeling Revenue Metrics
View source1. Install with the skills CLI
npx skills add posthog/posthog/modeling-revenue-metrics --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by posthogModeling revenue metrics
Turn payment/subscription data into durable revenue models. Read modeling-warehouse-foundations first for
the view-vs-dbt decision, the view-* workflow, and convertCurrency(); this skill is the revenue-specific
layer on top. Metric definitions live in
references/revenue-metric-definitions.md; copy-paste recipes in
references/posthog/ and references/dbt/.
Step 1 — find where revenue lives
Revenue reaches PostHog two ways; both feed the same managed revenue_analytics_* views:
- A payment platform as a warehouse source — Stripe today (Chargebee/Polar/RevenueCat coming). Best when
the business runs on a billing platform. Connect via
setting-up-a-data-warehouse-source. - Custom revenue events — you send events (e.g.
purchase_completed) with a revenue property. Best when there's no supported platform or you already track revenue in-product.
If neither exists yet, use suggesting-data-imports to recommend a source. In dbt, the equivalent is
staging whichever billing tables landed in the warehouse.
Step 2 — model on the managed views, not raw tables
PostHog auto-generates a curated set of views per source. Do not re-derive revenue from raw Stripe tables — the managed views already handle deferred-revenue recognition, currency, and a stable schema.
Discover the exact names (they're prefixed by source, e.g. stripe.<prefix>.…, plus a cross-source
revenue_analytics.all.…):
SELECT table_name FROM system.information_schema.tables WHERE table_name ILIKE '%revenue_analytics%'
| Managed view | Grain | Use for |
|---|---|---|
revenue_item (start here) | 1 / invoice line item | Gross revenue, monthly recurring revenue, revenue by product/customer/period. Implements deferred revenue + currency. |
mrr | 1 / (customer, subscription) | Live snapshot of current MRR — not a time series. |
customer | 1 / customer | dim_customer: email, country, cohort, metadata. |
subscription | 1 / subscription | Subscription state for churn/expansion logic. |
charge | 1 / charge | Raw charges; prefer revenue_item unless you specifically need charges. |
product | 1 / product | Product dimension. |
Key revenue_item columns: amount (already converted to the project base currency), currency (that
base currency), original_amount / original_currency (as charged), is_recurring, customer_id,
subscription_id, product_id, group_0_key…group_4_key (B2B account keys), timestamp.
Rules before you model (revenue gotchas)
- MRR is empty without a subscription config. For event-based revenue, MRR only populates when a subscription property is configured. Empty MRR + populated gross revenue is expected behaviour, not a bug — say so instead of "fixing" it.
- The
mrrmanaged view is a current snapshot, not history ("MRR at the current time"). For MRR over time, sum recurringamountper month fromrevenue_item(see the recipe), or materialize a monthly snapshot of themrrview on a schedule. amountis already in base currency. Use it directly for reporting. Only callconvertCurrency(original_currency, 'XXX', original_amount, timestamp)when you need a different target currency, or when working from raw events.- Link revenue to people via metadata. Person/group-level revenue needs
posthog_person_distinct_idmetadata on the Stripe customer (or the person join). Without it, revenue is customer-level only. - Don't build on the Revenue dashboard — it's being retired (~2026-06-30). Model against the
revenue_analytics_*views and the person/group revenue properties. - Exclude test accounts. Confirm
filter_test_accountsbehaviour so QA/internal charges don't inflate revenue.
Step 3 — build the model
PostHog: write the HogQL (alias every column), view-create, verify with view-get, then
view-materialize the expensive monthly rollups (a daily sync_frequency is usually right for revenue).
Recipes: references/posthog/ — mrr_and_arr.sql, gross_revenue_by_month.sql,
revenue_by_customer.sql.
dbt: stage the billing source → fct_revenue_item, fct_mrr, dim_customer marts with tests.
Recipes: references/dbt/. Note dbt has no convertCurrency() — supply a rate seed.
Then register the model (references/governance.md in foundations): annotate columns and, if MRR/ARR is a
headline number, propose it to the semantic layer.
File map
| File | Read when |
|---|---|
references/revenue-metric-definitions.md | Precise definitions: MRR, ARR, gross, new/expansion/contraction/churn, ARPU, LTV. |
references/posthog/ | HogQL view recipes on the managed views. |
references/dbt/ | dbt staging + fct_*/dim_* marts + schema.yml tests. |
Companions
modeling-warehouse-foundations (mechanics), setting-up-a-data-warehouse-source +
suggesting-data-imports (get Stripe/revenue data in), modeling-dimension-tables (currency/plan
dimensions), querying-posthog-data (HogQL + the semantic-layer metric check).
Frequently asked questions about Modeling Revenue Metrics
Similar skills
Power BI Semantic Modeling
Optimize your Power BI data models with best practices.
Data Context Extractor
Tailor data analysis skills to your company's needs.
Power BI Performance Troubleshooting
Systematic guidance for optimizing Power BI performance.
Power BI Model Design Review
Optimize your Power BI data models with expert reviews.
Power BI DAX Formula Optimizer
Optimize your DAX formulas for better performance and clarity.
Fabric Lakehouse
Optimize your data solutions with Lakehouse best practices.
