kapa.ai How to Write a Custom Formula for MoM Growth in Mixpanel Your goal is to create a Custom Formula in Mixpanel that calculates the Month-over-Month (MoM) growth for the sum of the event property "Markup PLN" within the "Transaction" event.
To calculate MoM growth for the sum of Markup PLN on the Transaction event using an Insights Formula metric, you’ll set up: 1. A metric for this month’s sum of Markup PLN
2. A metric for last month’s sum of Markup PLN
3. A Formula that computes the percentage change between them.Mixpanel Formulas support basic arithmetic (+ - * / ()) and constants, which is enough for a MoM % formula. [Insights advanced]---
Step 1 – Metric A: Sum of Markup PLN (this month)
In an Insights report: 1. Metric type: Simple Behavior (events) [Insights basic features]
2. Event: Transaction
3. Measurement: Aggregate Property → Sum [Aggregate property; Measurements]
4. Property: Markup PLN
5. Date range (top-right): e.g. Last 30 days or Last month (this will be your current month definition)Call this metric A (Mixpanel will label it A automatically when you add a Formula).---
Step 2 – Duplicate as Metric B for previous month
Create a second metric: 1. Duplicate Metric A (or add another metric with the same settings). 2. Change only the date range to the previous equivalent period (e.g. Previous 30 days or Previous month).This metric will be labeled B.**(The docs don’t explicitly describe the exact “previous period” presets in the Formula context, but they do document the general pattern of using multiple metrics and then combining them via a Formula.)** [Insights advanced]---
Step 3 – Add the MoM growth Formula
1. Click + Formula in the Metrics area. [Insights advanced]
2. In the formula editor, use: text (A - B) / B ** 100LBKSInterpretation: - A = Sum of Markup PLN this month
- B = Sum of Markup PLN last month
- (A - B) / B ** 100 = MoM % growthYou can then Rename the formula to something like MoM Growth – Markup PLN via the metric overflow menu. [Insights advanced]---
Notes / Limitations
- The docs confirm arithmetic support in Formulas but do not document any built‑in “MoM” function or automatic prior‑period reference inside a single metric, so defining two metrics (current and previous month) plus a Formula is the supported pattern inferred from the available documentation. [Insights advanced] - Ensure both A and B use identical measurement (Aggregate Property → Sum of Markup PLN) and only differ by date range, or the growth result will be misleading.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
