Menu

SaaS churn rate in SQL: four Stripe status traps that skew the number
📰

SaaS churn rate in SQL: four Stripe status traps that skew the number

DEV Community: sql·Vasyl Popovych·9 days ago
#fZgcpNJG
#devtosql#devto#dev#null#customer
Long article (2320 words) — no AI summary yet.
Reading 0:00
15s threshold

Customer churn rate is one division: customers you lost during a period, divided by customers you had at the start of it. It takes ten seconds to write on a whiteboard.

Getting the same number out of a Stripe subscriptions table takes longer. The table has no "customer left on this date" column. It has statuses, and a few of them look like churn without being churn. If your query groups canceled subscriptions by canceled_at , it is probably counting some customers in the wrong month and some who never left.

Below is a PostgreSQL query that handles those cases, plus a small dataset you can run it against.

The formula and its two assumptions

monthly churn rate = customers lost during the month / paying customers on day 1 of the month * 100

Enter fullscreen mode

Exit fullscreen mode

Two assumptions hide in that line:

The denominator is fixed on day 1. Someone who signs up on the 12th is not part of this month's base, so they can't churn from it either.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.