Skip to content
tezvyn:

Explain cohort analysis and write a retention query

Source: amplitude.comMediumHow cards are made

Explain cohort analysis and write a retention query

Tests your grasp of user behavior metrics. First, define a cohort (e.g., May signups). Then, explain why it's better than aggregate retention. Finally, outline a query grouping users by signup week and checking for activity. A red flag is a flawed query.

What's really being asked

This question assesses your data literacy and practical analytics skills. It's not just about knowing the definition of "cohort." Interviewers want to see if you understand why cohort analysis is superior to aggregate metrics for understanding user behavior. They are testing your ability to think in terms of user groups, time-series analysis, and how to translate that logic into a data query. It separates candidates who can recite definitions from those who can actually measure product health.

The full answer

A strong answer has three parts. First, define a cohort as a group of users who share a common characteristic over a specific time period, like signing up in May. Second, explain its value: cohort analysis isolates variables. It shows if product changes improve retention for new users, something hidden by aggregate metrics that average old, loyal users with new ones. Third, outline the pseudo-query. This involves selecting the signup month/week as the cohort, then joining a user table with an activity/events table. The core logic is to count the distinct users from the May cohort who also have an activity record in week 1, week 2, and week 4 post-signup.

The mistakes people make

A major red flag is confusing cohort retention with aggregate retention. For example, saying "we retained 80% of our users this month" is an aggregate metric. A cohort answer would be "the May signup cohort had a 4-week retention of 25%." Another common mistake in the query is failing to properly define the time windows. For example, calculating week 2 retention by just looking at the second week of May, rather than the second week after each user's individual signup date. The query must be relative to the user's start date. Getting the logic wrong is the critical failure.

What usually comes next

Be ready for "How would this change for rolling retention vs. classic retention?". Or, "Imagine our retention for the May cohort is 10% lower than April's. What are the first three things you would investigate?". Another likely question is about tooling: "How would you build a dashboard for this? What tools would you use and why?". They might also ask you to write the query in a specific SQL dialect.

A concrete example

A pseudo-query would first create a temporary table (or CTE) of users who signed up in May. Let's call it may_signups. Then, you would query this may_signups table, joining it to a user_activity table on user_id. The main query would select conditional counts. For 1-week retention, you'd count distinct users where the activity date is between 7 and 14 days after their individual signup date. You'd do the same for 2 weeks (14-21 days) and 4 weeks (28-35 days). Finally, you divide these counts by the total number of users in the may_signups cohort to get the retention percentages.

Interview question

Why is cohort analysis generally more insightful for measuring the impact of a product change than looking at an overall aggregate retention rate?

  • a.It measures user activity across the entire user base within a fixed calendar month, like May.
  • b.It provides a higher retention number, which is better for reporting.
  • c.It isolates the behavior of a specific user group, separating the impact of changes from the behavior of older, established users.Correct
  • d.It is computationally simpler to calculate than aggregate retention since it uses a smaller dataset.
Why?

Cohort analysis isolates variables by grouping users (e.g., by signup month). This allows you to see if a change impacted new user retention, an effect that would be hidden or diluted in an aggregate metric that averages new users with old, loyal ones.

Just read this? Test yourself on what you have been reading.

Read the original → amplitude.com

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on analytics — each one lists the topics its interview covers.

See open roles