How to Build Cohort Analysis Without SQL: A Guide for Product Teams

PPriya SharmaAPR 04 2026 · 8 MIN

Cohort analysis is one of the most useful tools in a product team's arsenal. It tells you whether the improvements you shipped last month actually stuck or whether users who signed up in February are churning at the same rate as users from six months ago. The problem is that cohort analysis has traditionally lived behind a wall of SQL, accessible only to whoever controls the data warehouse.

This guide walks through what cohort analysis actually is, why it matters, and how product managers and analysts can run it without writing a single query.

What Is Cohort Analysis (and Why Teams Get It Wrong)

A cohort is a group of users who share a common characteristic at a specific point in time. The most common cohort is "users who signed up during week X." Cohort analysis then tracks what those users did over the following weeks or months.

The classic mistake is treating cohort analysis as a one-time report. You run it once, see that week-2 retention is 42%, nod sagely, and move on. That number means nothing in isolation.

What actually matters:

  • Is week-2 retention improving cohort over cohort?
  • Did a specific product change in March move the needle?
  • Are users from one acquisition channel retaining better than users from another?
  • To answer those questions, you need to run cohort analysis continuously which means you need easy, repeatable access to your database.

    The Standard SQL Approach (and Why It Breaks Down)

    Here's what a typical cohort retention query looks like in PostgreSQL:

    WITH cohorts AS (
      SELECT
        user_id,
        DATE_TRUNC('week', created_at) AS cohort_week
      FROM users
    ),
    activity AS (
      SELECT
        user_id,
        DATE_TRUNC('week', activity_date) AS activity_week
      FROM user_events
      WHERE event_type = 'session_start'
    ),
    cohort_activity AS (
      SELECT
        c.cohort_week,
        c.user_id,
        EXTRACT(EPOCH FROM (a.activity_week - c.cohort_week)) / 604800 AS week_number
      FROM cohorts c
      JOIN activity a ON c.user_id = a.user_id
    )
    SELECT
      cohort_week,
      week_number,
      COUNT(DISTINCT user_id) AS active_users
    FROM cohort_activity
    WHERE week_number >= 0 AND week_number <= 12
    GROUP BY cohort_week, week_number
    ORDER BY cohort_week, week_number;

    This works if you know SQL, understand your schema, and have time to write it. Then modify it when your schema changes. Then re-run it every week. Then explain it to your PM who wants to slice by pricing plan.

    Most product teams have one person who owns this query. When that person is on vacation, cohort analysis stops.

    Running Cohort Analysis in Plain English

    With a tool like AI for Database, you describe what you want in plain English and the AI writes and executes the query against your actual database.

    Instead of the query above, you type:

    "Show me weekly retention cohorts for users who signed up in Q1 2026. Group by signup week and show retention through week 8."

    The system translates that into SQL, runs it against your database, and returns a cohort table no intermediate step where you copy-paste a query into a SQL client.

    More importantly, you can then ask follow-up questions:

    "Now break that down by pricing plan."
    "Which cohort had the highest week-4 retention?"
    "Filter to users who completed onboarding within 24 hours of signup."

    Each follow-up refines the analysis without rewriting a query. For product teams doing weekly retention reviews, this removes the bottleneck entirely.

    Setting Up Your First Cohort Analysis

    Whether you're using SQL directly or a natural language interface, you need three things:

    1. A signup/creation date for each user

    Usually this is users.created_at. Make sure it's a proper timestamp, not a string. If your users table doesn't have this, check for an account_activations or onboarding_completions event table.

    2. An activity signal

    This is the event that defines "active." Common choices:

  • Any login or session start
  • A key action (completed a task, made a purchase, sent a message)
  • A meaningful engagement threshold (viewed 3+ pages)
  • The right signal depends on what "retained" means for your product. For a project management tool, it's probably "created or updated a task." For a messaging app, it's probably "sent a message." Avoid using page views they're too noisy.

    3. A time window

    Decide on your cohort period (weekly is usually right for SaaS products) and how many periods forward you want to track.

    Once you have these three elements, your cohort query whether typed in SQL or described in plain English will be consistent and repeatable.

    Reading Cohort Tables: What Good Looks Like

    A standard cohort retention table looks like this (simplified):

    Cohort Week | Week 0 | Week 1 | Week 2 | Week 4 | Week 8

    2026-01-06 | 100% | 52% | 41% | 35% | 28%

    2026-01-13 | 100% | 54% | 43% | 37% | 30%

    2026-01-20 | 100% | 56% | 46% | 39%

    2026-01-27 | 100% | 61% | 49%

    A few things to notice:

    The diagonal tells you recent cohorts are improving. Each cohort's week-1 retention is trending up (52% → 61%). That's a signal that something you changed in January is working.

    Recent cohorts have incomplete later weeks. The January 27 cohort is too recent to have week-4 data. That's expected don't read absence of data as a bad signal.

    Week-0 is always 100%. It's your baseline. If you see anything other than 100% in week 0, your cohort definition has a problem.

    When cohort retention flattens rather than continuing to drop, that's healthy. It means some portion of each cohort has found enough value to keep coming back indefinitely. Products with strong cohort flattening build durable growth.

    Segmenting Cohorts: Where the Real Insights Live

    Basic week-by-week cohort analysis is a starting point. The insights usually come from segmentation.

    By acquisition channel:

    SELECT
      u.cohort_week,
      u.acquisition_source,
      u.week_number,
      COUNT(DISTINCT u.user_id) AS active_users
    FROM cohort_activity u
    GROUP BY u.cohort_week, u.acquisition_source, u.week_number;

    Or in plain English: "Show me cohort retention by acquisition source for users who signed up in Q1."

    If organic search users retain at 40% week-4 but paid social users retain at 18%, you have a channel mix problem not just a retention problem.

    By onboarding completion:

    Users who complete your onboarding flow almost always retain better. Quantifying that gap gives you a business case for investing in onboarding improvements.

    By plan or tier:

    Pro users retaining at 60% while free users retain at 20% isn't surprising but the question is whether your free-to-paid conversion is happening before or after week 4. That determines where to put your upgrade prompts.

    Making Cohort Analysis a Team Habit

    The reason cohort analysis stays siloed in most companies isn't that people don't care it's that access is too hard. If you have to file a Jira ticket to get a query run, you'll only look at cohorts when something is obviously wrong.

    The alternative: put cohort analysis in a shared dashboard that refreshes automatically.

    With AI for Database, you can build a dashboard that runs your cohort query on a schedule and shows the updated table every Monday morning before your product review meeting. No manual steps. No dependency on whoever owns the SQL.

    When any team member can ask follow-up questions in plain English, cohort analysis stops being a weekly report and starts being an ongoing conversation about user behavior.

    Start querying your database for free → Connect in 2 minutes at aifordatabase.com, no SQL required.

    Frequently Asked Questions

    What's the difference between cohort analysis and churn rate?

    Churn rate gives you a single number across all users at a point in time. Cohort analysis shows you how different groups of users behave over time. Churn rate can look stable while cohort retention is actually getting worse (if newer cohorts churn faster but older users stay). Cohort analysis is more accurate for understanding whether your product is improving.

    How many users do I need before cohort analysis is meaningful?

    A rough minimum is 100 users per cohort period for the numbers to be statistically stable. Below that, week-to-week variance will look like signal but it's mostly noise. If you have fewer users, aggregate into monthly cohorts instead of weekly.

    What database types support the SQL needed for cohort analysis?

    PostgreSQL, MySQL, BigQuery, Redshift, Snowflake, and most other relational databases support the window functions and date arithmetic needed. MongoDB requires aggregation pipelines, which are more verbose but achievable. AI for Database supports all of these.

    Should I track cohorts by signup date or first activity date?

    Usually signup date, because it ties directly to acquisition timing. But for products with a meaningful lag between signup and first meaningful use (like a scheduling tool that's only valuable after an appointment happens), first activity date can be more predictive.

    My cohort retention looks terrible at week 1. What should I look at first?

    Check your onboarding flow first. A high day-1 or week-1 drop-off usually means users signed up with the right intent but hit friction a confusing setup process, a missing integration, or a value moment that's too far downstream. Look at where in your product users are when they go quiet.

    Can I do cohort analysis on non-user events, like orders or payments?

    Yes. You can cohort by first purchase date and track repeat purchase rates, or by first subscription date and track renewal rates. The mechanics are identical you're just swapping "user signup" for "first order" and "session" for "purchase."

    What's the easiest way to share cohort results with stakeholders who don't use SQL tools?

    Build a shared dashboard with the cohort table and set it to refresh automatically. With AI for Database, you can share dashboard links with anyone on your team. They can view the latest data without logging into a database client or waiting for someone to re-run a query. --- Cohort analysis isn't a sophisticated technique reserved for companies with data teams. It's a practical way to know whether what you're building is working and whether the users you're acquiring are the right ones. The barrier has always been access to the data, not the analysis itself. Remove that barrier and cohort analysis becomes a weekly habit rather than a quarterly exercise. If you want to run your first cohort query without writing SQL, [try AI for Database free at aifordatabase.com](https://aifordatabase.com).

    Ready to try AI for Database?

    Query your database in plain English. No SQL required. Start free today.