Cohort Retention Analysis in BigQuery: Monthly Table

Build a monthly cohort retention table in BigQuery from an orders or events table: cohort by first month, retention by months since, and how to read it.

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
  1. Who this report is for
  2. What the report includes
  3. How to build it in Better Analyst from Google BigQuery
  4. Questions to ask
  5. Sample output
  6. Charts to use
  7. Keep it up to date
  8. Further reading
  9. FAQ

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

Metrics and dimensions in this report
MetricSource fieldWhy it matters
Customerorders.customer_id (example schema)The unit being retained; use your customer or user key.
Activity dateorders.order_date (example schema)Each customer's purchases, from which the first month and later active months are derived.
Cohort monthCalculated: DATE_TRUNC(MIN(order_date), MONTH) per customerGroups customers who started in the same month.
Months since first orderCalculated: DATE_DIFF(order month, cohort month, MONTH)Aligns every cohort on month 0, 1, 2 … for comparison.
RetentionCalculated: active customers in month N ÷ cohort sizeThe share of each cohort still buying N months later.

How to build it in Better Analyst from Google BigQuery

  1. In Better Analyst, open Connectors, choose Add Connector, then BigQuery.
  2. 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.
  3. 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.
  4. Tell Better Analyst which table holds orders or activity and which columns are the customer ID and date, or add that to Data Context.
  5. 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.

Sample data: monthly cohort retention, % of cohort ordering again (illustrative)
CohortCustomersMonth 1Month 2Month 3Month 6
Jan 20261,84022.4%16.1%13.8%10.2%
Feb 20261,61523.9%17.0%14.6%11.0%
Mar 20262,21019.7%14.2%12.1%9.1%
Apr 20261,93025.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

Try Better Analyst free

Frequently asked questions

Should retention count any order or only paid ones?
Define 'active' to match the question: any order for repeat purchase behaviour, a paid renewal for subscriptions, or a meaningful product event for apps. Keep the definition the same across cohorts.
Why does the newest cohort have empty cells?
It hasn't existed long enough. A cohort that started three months ago can only have months 1–3 filled; mark later cells n/a rather than 0%.
Is this the same as churn?
Related but different: retention by cohort shows the share of each starting group still active in month N, while churn is usually measured across your whole active base for one period.