Skip to content
Telemetry
Revenue and billing SQL recipe

Calculate trial-to-paid conversion

Measure how many trial accounts become paid customers within a fixed conversion window.

Intermediatesubscription_eventsReviewed 2026-07-27Tested with Apache DataFusion 45.2.0

Reviewed by the Telemetry product team on . We checked the SQL syntax, required event fields, sample results, and limits on using the query. Who reviews this page

Question answered

Which trial cohorts and acquisition sources convert to paid accounts?

A conversion rate needs a cohort, a deadline, and one counting unit. This query anchors accounts on their first trial and counts only paid events within 30 days.

Event schema

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampSubscription event time.
account_idUtf8Stable billing account identifier.
event_nameUtf8trial_started or subscription_started.
acquisition_sourceUtf8Source captured when the trial began.
DataFusion SQL

Copy the query

sql
WITH trials AS (
  SELECT
    account_id,
    MIN(timestamp_utc) AS trial_started_at,
    MIN(acquisition_source) AS acquisition_source
  FROM subscription_events
  WHERE event_name = 'trial_started'
    AND timestamp_utc >= now() - INTERVAL '120 days'
  GROUP BY account_id
),
paid AS (
  SELECT
    account_id,
    MIN(timestamp_utc) AS paid_at
  FROM subscription_events
  WHERE event_name = 'subscription_started'
  GROUP BY account_id
)
SELECT
  date_trunc('week', trials.trial_started_at) AS trial_week,
  trials.acquisition_source,
  COUNT(*) AS trial_accounts,
  SUM(CASE
    WHEN paid.paid_at >= trials.trial_started_at
      AND paid.paid_at < trials.trial_started_at + INTERVAL '30 days'
    THEN 1 ELSE 0
  END) AS paid_accounts,
  100.0 * SUM(CASE
    WHEN paid.paid_at >= trials.trial_started_at
      AND paid.paid_at < trials.trial_started_at + INTERVAL '30 days'
    THEN 1 ELSE 0
  END) / NULLIF(COUNT(*), 0) AS conversion_rate_pct
FROM trials
LEFT JOIN paid ON paid.account_id = trials.account_id
GROUP BY
  date_trunc('week', trials.trial_started_at),
  trials.acquisition_source
ORDER BY trial_week, acquisition_source;

This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. We review the synthetic sample output separately. Check field types, thresholds, and counting rules against your own data. Read the testing methodology.

Query result

Thirty-day trial conversion by source

Product referrals convert at the highest rate despite having the smallest cohort.

trial_weekacquisition_sourcetrial_accountspaid_accountsconversion_rate_pct
2026-06-29docs1844122.28
2026-06-29paid_search3103711.94
2026-07-06product_referral962829.17

Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.

Thirty-day trial conversion by source: static chart of synthetic conversion_rate_pct values from the Calculate trial-to-paid conversion example result
Download this SVG chart of the sample results for an article, runbook, or design review. Please credit Telemetry.

Reproduce the example

Download the sample data

The JSON bundle includes the event schema with field types, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.

How the SQL works

  1. 1The trial CTE creates one cohort record per account.
  2. 2The paid CTE prevents multiple subscription events from counting the same account twice.
  3. 3The 30-day condition keeps cohorts comparable even when eventual conversion happens much later.

Edge cases to check

  • Exclude cohorts that have not had the full conversion window before comparing final rates.
  • Decide how a cancelled and restarted trial should enter the cohort.
  • Persist acquisition source at trial start so later attribution changes do not rewrite history.

Recommended dashboard

  • Bars: conversion_rate_pct by acquisition_source
  • Trend: paid conversion by trial_week
  • Table: trials approaching the end of the conversion window

Alert guidance

Review cohorts weekly after their observation windows close. Flag results below your chosen threshold for that source's recent baseline.

Read alert setup

Set up the events this query needs

Related instrumentation and guides

Continue the analysis

Run it on your events

Create a table, adapt the fields, and save the result

Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.

Get an API key