跳到正文
Skillpedia
分析与电子表格41k · #6852

modeling-revenue-metrics

它能做什么

本技能根据账单数据或收入事件,对经常性收入和总收入指标进行建模,包括 MRR、ARR、流失和生命周期价值。适合希望获得可靠收入数字的财务和增长团队。

适用场景

  • ✓当你想根据账单数据计算月度或年度经常性收入时。
  • ✓当你想按客户查看收入流失、扩展或生命周期价值的时候。
  • ✓当你希望收入数字来自 PostHog 的托管收入视图时。

技能链接

https://github.com/PostHog/posthog/blob/master/products/data_modeling/skills/modeling-revenue-metrics/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/PostHog/posthog/blob/master/products/data_modeling/skills/modeling-revenue-metrics/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请根据我们的 Stripe 数据,计算最近六个月的月度经常性收入和流失情况。”

每周 5 个新技能,1 分钟读完。

工作原理

如果已连接受支持的账单平台,AI 会使用 PostHog 为其提供的托管收入视图;如果没有连接平台,则使用自定义收入事件。随后,它计算所选的指标,并将其保存为可复用的模型,以确保数字保持一致。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Modeling 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 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.

Each source gets its own views. There is no cross-source view. Names depend on the source type:

  • Warehouse source: <source>.<prefix>.<kind>_revenue_view, for example stripe.prod.mrr_revenue_view. The <prefix>. part is absent when the source has no prefix.
  • Custom revenue events: revenue_analytics.events.<event_name>.<kind>_events_revenue_view, where every non-alphanumeric character in the event name becomes _.

<kind> is one of the managed views in the table below. Discover the exact names. Do not search for revenue_analytics, because it does not match warehouse source views:

SELECT table_name FROM system.information_schema.tables
WHERE position(table_name, 'revenue_view') > 0 ORDER BY table_name

If this returns nothing, the project has no revenue source configured yet. Check the governed mrr metric (metric-list) or discover warehouse billing tables, and read their columns before modeling. Do not guess view names.

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)

  1. 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.
  2. **The mrr manag
常见问题

我需要 Stripe 吗?

目前 Stripe 是受支持的账单来源。如果没有受支持的平台,你可以改为将收入作为自定义事件发送。

收入应该从原始账单表计算吗?

不应。托管视图已经处理了收入确认和货币问题,因此本技能使用这些视图,而不是原始表。

它能计算哪些收入指标?

涵盖 MRR 和 ARR 等经常性收入、新增、扩展和流失收入、每用户平均收入,以及生命周期价值。

详情

作者的原始描述

Build reusable revenue models — MRR, ARR, gross revenue, new/expansion/contraction/churn, ARPU, LTV, and per-customer/per-account revenue — on either PostHog data-warehouse views (HogQL) or an external dbt project. Use when the user wants to model, define, or compute recurring revenue, monthly/annual recurring revenue, churn or retention of revenue, lifetime value, average revenue per user, or revenue by customer, cohort, product, or currency. On PostHog, build on the managed *_revenue_view views (revenue_item, mrr, customer, subscription, charge, product) fed by Stripe or custom revenue event

repo: PostHog/posthog

热度

GitHub 星标
41k
排名
#6852
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能