Turn a business question into a SQL query
Describe your tables and the question you need answered and get a correct, commented SQL query with assumptions spelled out.
Set up a proper cohort retention analysis, from defining cohorts and the activity event to producing the table and reading it correctly.
Help me do a cohort retention analysis.
Product or business: {{business}}
Cohort is defined by: {{cohort_basis}}
Retention means the user did this: {{retention_event}}
Time granularity: {{granularity}}
Data tables and columns available: {{data}}
Tool: {{tool}}
Provide:
1. Definitions: restate the cohort, the retention event, and the time bucket exactly. Point out any ambiguity (for example, is the first period "period 0" or "period 1"? is retention "active in period N" or "active in N or later"?). Recommend which to use.
2. Step by step build: the logic for assigning each user to a cohort, computing periods since cohort start, counting active users per cohort-period, and dividing by cohort size. Then give working {{tool}} code.
3. Incomplete periods: show how to avoid counting partially elapsed periods as drop-offs.
4. How to read the retention table: what the diagonal pattern, a flat tail, and a steepening drop each mean. Describe the retention curve shape for a healthy product of this type and what would be a warning sign.
5. Pitfalls: small cohorts, changing definitions of the activity event, seasonality, reactivated users, bots or internal users.
6. Three follow-up cuts that could explain differences between cohorts (for example acquisition channel, plan, first-week behavior).
7. A heatmap spec: colour scale, labeling, and how to show cohort sizes.
State your assumptions, and ask about any detail that would change the code.Defining the retention event and the period numbering up front prevents the off-by-one confusion that makes retention tables untrustworthy. Ask for rolling retention variants if your product has infrequent use.
Licensed CC0 (public domain) Version 1 · history
Describe your tables and the question you need answered and get a correct, commented SQL query with assumptions spelled out.
Turn a dataset description into a step-by-step exploration plan with checks, hypotheses and the first charts to make.
Convert a stakeholder's fuzzy ask into a scoped analysis brief with the real question, definitions, data needed and success criteria.
Systematically diagnose why a metric suddenly changed, ranking likely causes and giving the exact checks to confirm each one.
Investigate why a key metric moved: a structured hypothesis tree, the data cuts to run, and a prioritized plan to confirm and fix.
Paste a regression table and get a careful interpretation of coefficients, fit and reliability, with warnings about causal claims.
Comments (0)
Sign in to join the discussion.
No comments yet. Be the first to share how it worked.