Loading the editor…
For each workspace creation month, count workspaces and how many are currently active.
Growth reports cohorts by the month the workspace was created. Current status is the subscription with the latest started_at, because some workspaces changed plan.
Return cohort_month (YYYY-MM), workspaces, and active_workspaces. cohort_month comes from workspaces.created_at. A workspace is active when its latest subscription status is active. Sort by cohort_month.
| id | name | created_at | country | |
|---|---|---|---|---|
| 1 | Maya Chen | maya@lumen.app | 2023-01-05 | US |
| 2 | Andre Silva | andre@orbit.io | 2023-02-11 | BR |
| 3 | Sophie Laurent | sophie@northstar.co | 2023-03-20 | FR |
| id | name | plan | owner_id | created_at |
|---|---|---|---|---|
| 1 | Lumen | pro | 1 | 2023-01-06 |
| 2 | Orbit Analytics | starter | 2 | 2023-02-12 |
| 3 | Northstar | pro | 3 | 2023-03-21 |
| id | workspace_id | plan | status | mrr | started_at | canceled_at |
|---|---|---|---|---|---|---|
| 1 | 1 | starter | canceled | 19 | 2023-01-06 | 2023-04-01 |
| 2 | 1 | pro | active | 79 | 2023-04-02 | NULL |
| 3 | 2 | starter | canceled | 19 | 2023-02-12 | 2024-11-01 |
| id | user_id | workspace_id | name | occurred_at |
|---|---|---|---|---|
| 1 | 1 | 1 | query_run | 2023-01-20 |
| 2 | 1 | 1 | dashboard_view | 2023-02-11 |
| 3 | 2 | 2 | query_run | 2023-02-18 |
| id | workspace_id | amount | status | issued_at | paid_at |
|---|---|---|---|---|---|
| 1 | 1 | 79 | paid | 2025-01-01 | 2025-01-01 |
| 2 | 1 | 79 | paid | 2025-02-01 | 2025-02-02 |
| 3 | 3 | 79 | paid | 2025-02-01 | 2025-02-01 |
Ctrl or Cmd + Enter runs the query. The database resets on every run.
Run the query to see rows from the sample database.
Next exercise: Months in previous roles
Related: Invoiced amount by workspace, Second-month user retention