Formulas & SQL · Copy-Paste Benchmarks
Production ecommerce formulas & BigQuery SQL.
Copy-paste BigQuery SQL queries and margin-adjusted unit economics formulas for RFM scoring, break-even ROAS, repeat purchase rate, CLV and Shopify cohort retention.
- BigQuery SQL · Customer Segmentation
RFM Score Formula & BigQuery SQL Query for Ecommerce
Calculate Recency, Frequency and Monetary (RFM) customer segments directly in BigQuery using NTILE(5) quantiles on net revenue after returns. Ready-to-run SQL included.
- Quantile Scale
- 1–5 (NTILE)
- Refund Hygiene
- Net Revenue
- Unit Economics · Paid Media
Contribution Margin & Break-Even ROAS Formula for Ecommerce
Calculate true break-even ROAS and contribution margin per order including COGS, payment fees, fulfillment and return rates. Stop scaling unprofitable ad campaigns.
- Break-Even Formula
- 1 / CM%
- At 50% Margin
- 2.00×
- Retention Metrics · Ecommerce
Repeat Purchase Rate Formula & Retail Benchmarks
How to calculate Repeat Purchase Rate (RPR) accurately by cohort window, pair it with Time Between Orders, and benchmark fashion, beauty and home ecommerce stores.
- Formula
- Repeat / Total
- Beauty Benchmark
- 30–45%
- Unit Economics · CLV Modeling
Customer Lifetime Value (CLV) Formula for Ecommerce
Calculate margin-adjusted Customer Lifetime Value (CLV) for ecommerce using historical cohorts and contribution margin—plus how to avoid the classic AOV×Frequency mistake.
- Target LTV:CAC
- ≥ 3:1
- Payback Guardrail
- ≤ 90 days
- BigQuery SQL · Shopify Plus
Shopify Cohort Retention Analysis in BigQuery SQL
Copy-paste BigQuery SQL query to build monthly customer retention and cumulative revenue cohorts from Shopify orders—ready for Looker Studio dashboards.
- Output
- M0 → M12
- BI Ready
- Looker Studio