Cohort Retention Analysis in BigQuery: Monthly Table
Summary
A cohort retention analysis groups customers by the month of their first purchase (or signup) and shows what share came back in each later month. In BigQuery it takes a first-activity CTE, a month-difference calculation and a pivot; in Better Analyst you ask for the table and check the SQL it shows you.
On this page
Who this report is for
Ecommerce and subscription analysts, growth teams and founders with order or activity data in BigQuery who want to know whether newer customers retain better than older ones.
What the report includes
| Metric | Source field | Why it matters |
|---|---|---|
| Customer | orders.customer_id (example schema) | The unit being retained; use your customer or user key. |
| Activity date | orders.order_date (example schema) | Each customer's purchases, from which the first month and later active months are derived. |
| Cohort month | Calculated: DATE_TRUNC(MIN(order_date), MONTH) per customer | Groups customers who started in the same month. |
| Months since first order | Calculated: DATE_DIFF(order month, cohort month, MONTH) | Aligns every cohort on month 0, 1, 2 … for comparison. |
| Retention | Calculated: active customers in month N ÷ cohort size | The share of each cohort still buying N months later. |
How to build it in Better Analyst from Google BigQuery
- In Better Analyst, open Connectors, choose Add Connector, then BigQuery.
- Connect with Google sign-in, or upload a service-account JSON key for an account with the BigQuery Data Viewer and BigQuery Job User roles.
- Select the project and dataset, test the connection and save. Queries are read-only, and BigQuery's normal query pricing applies to what you scan.
- Tell Better Analyst which table holds orders or activity and which columns are the customer ID and date, or add that to Data Context.
- Ask for a monthly cohort retention table for the last 12 cohorts, with cohort sizes, as percentages.
Questions to ask
- “Build a monthly cohort retention table from the orders table for customers who first ordered in the last 12 months.”
- “Do customers acquired in Q3 retain better at month 3 than those from Q1?”
- “Show retention curves for customers whose first order used a discount code versus those who didn't.”
- “What share of revenue in month 6 comes from repeat customers in each cohort?”
Sample output
Sample data for illustration, not real account data.
| Cohort | Customers | Month 1 | Month 2 | Month 3 | Month 6 |
|---|---|---|---|---|---|
| Jan 2026 | 1,840 | 22.4% | 16.1% | 13.8% | 10.2% |
| Feb 2026 | 1,615 | 23.9% | 17.0% | 14.6% | 11.0% |
| Mar 2026 | 2,210 | 19.7% | 14.2% | 12.1% | 9.1% |
| Apr 2026 | 1,930 | 25.3% | 18.4% | 15.9% | n/a |
Charts to use
- Cohort retention heatmap (Heatmap table): Cohorts as rows and months since first order as columns, shaded by retention.
- Retention curves (Line chart): One line per cohort, showing whether newer cohorts flatten at a higher level.
Keep it up to date
Refresh the cohort table monthly with a scheduled task, or have a Data Flow write it to a BigQuery table that a dashboard reads.
Further reading
Frequently asked questions
Should retention count any order or only paid ones?
Why does the newest cohort have empty cells?
Is this the same as churn?
Related reports
GA4 BigQuery Export Analysis: Query Raw Events Without SQL
Analyse the GA4 BigQuery export: sessions, purchases and paths from events_* tables, the key columns, UNNEST patterns, and plain-English queries.
SaaS Metrics Dashboard from PostgreSQL: MRR, Churn and ARPA
Build a SaaS metrics dashboard from your PostgreSQL subscriptions table: MRR, new and churned MRR, logo churn and ARPA by month.