US PRODUCT ANALYTICS · WORKED SQL CASE
Conversion Rate Fell, but Every Channel Improved: A SQL Case Study
Separate a changing traffic mix from changes within each channel before recommending a product fix.
Can conversion fall when every channel improves?
Yes. The overall conversion rate is weighted by each channel’s share of sessions. If more sessions come from a lower-converting channel, the total rate can fall even when each channel’s own rate rises. Calculate total converted sessions divided by total sessions, then inspect both segment rates and segment weights.
This synthetic US e-commerce exercise is designed for product and marketing analyst interview practice. It is not an employer question, a market benchmark or evidence about any real campaign.
Define the question and denominator
A product manager sees conversion fall after a campaign launch and asks whether checkout broke. Before answering, define conversion as a session containing at least one completed purchase. Count each eligible session once, even if it contains several orders. Assign each session to exactly one channel using an unchanged classification rule.
Compare equally long, complete reporting periods in the same time zone. Confirm that purchase-event collection and consent-related measurement have not changed. The following table assumes these checks have passed. The question is descriptive: what explains the aggregate arithmetic? It does not establish why customer behavior changed.
Inspect the four input rows
- Before, Email: 900 sessions, 90 converted sessions; conversion 10%.
- Before, Social: 100 sessions, 2 converted sessions; conversion 2%.
- After, Email: 100 sessions, 12 converted sessions; conversion 12%.
- After, Social: 900 sessions, 27 converted sessions; conversion 3%.
Email improves from 10% to 12%. Social improves from 2% to 3%. But Email’s share drops from 90% to 10% of sessions. Most later sessions now come from the channel with the lower conversion rate.
Run the weighted conversion calculation
This self-contained query runs in SQLite, including Python’s built-in sqlite3 module. The columns contain counts, not percentages.
WITH traffic(period, channel, sessions, converted_sessions) AS (
VALUES ('before','Email',900,90), ('before','Social',100,2),
('after','Email',100,12), ('after','Social',900,27)
)
SELECT period,
SUM(sessions) AS sessions,
SUM(converted_sessions) AS converted_sessions,
ROUND(100.0 * SUM(converted_sessions)
/ NULLIF(SUM(sessions),0),2) AS conversion_pct
FROM traffic
GROUP BY period
ORDER BY CASE period WHEN 'before' THEN 0 ELSE 1 END;Verified result: before: 1,000 sessions, 92 converted sessions, 9.2%. After: 1,000 sessions, 39 converted sessions, 3.9%.
The decrease is 5.3 percentage points. Relative to 9.2%, it is approximately a 57.6% decrease. Label the distinction; saying “down 5.3%” would communicate a different change.
The formula uses sums so each session contributes equally to the overall rate. SQLite’s aggregate-function reference describes SUM and AVG. Multiplying by 100.0 avoids an integer-only ratio; see its expression and arithmetic reference. NULLIF leaves a zero-session denominator undefined rather than presenting it as zero conversion.
Why averaging channel percentages fails here
The simple average of the two earlier rates is (10% + 2%)/2 = 6%. The later average is (12% + 3%)/2 = 7.5%. Those numbers give each channel equal importance, regardless of whether it contributed 100 or 900 sessions. They do not describe the conversion probability of a randomly selected session in either period.
The correct earlier calculation is 90% × 10% + 10% × 2% = 9.2%. The later calculation is 10% × 12% + 90% × 3% = 3.9%. This reversal between within-group and aggregate comparisons is commonly described as Simpson’s paradox. The useful analytical habit is to show counts and weights, not merely attach a name to it.
Hold the earlier mix fixed as a diagnostic
Apply the later channel rates to the earlier session shares: 90% × 12% + 10% × 3% = 11.1%. Under that chosen fixed-mix calculation, the rate would be 1.9 percentage points above the earlier 9.2%. The observed later rate is 7.2 points below 11.1% because it uses the later mix instead.
This is a standardization exercise, not a forecast or a causal estimate. It assumes the observed later rates can be applied to the chosen earlier weights. A different reference mix gives a different decomposition. Do not claim that moving traffic back to Email will necessarily deliver 11.1%: audience intent, acquisition cost and capacity may change.
What should the business do next?
First, report both truths: fewer sessions converted overall, while measured conversion improved within both channels. Next, investigate the campaign’s objective. A broader prospecting campaign may intentionally reach lower-intent visitors, while still creating profitable new customers. Conversion rate alone cannot determine campaign value.
For a hypothetical $60 revenue per converted session, the sample would move from $5,520 to $2,340 in revenue. These are calculated scenario values, not observed revenue. Real decisions need actual order values, refunds, marketing costs and later customer value. Keep those inputs separate from this session-conversion metric.
Check device, new versus returning users and landing-page composition if those dimensions help answer a specific question. Avoid slicing a tiny sample into dozens of groups until one looks persuasive. Review uncertainty and use a suitable experiment when the question is whether a product change caused an effect.
Explain it in an interview
“I would validate tracking and the denominator first. In this example, overall conversion fell from 9.2% to 3.9%, but both channel rates improved. The session mix shifted strongly toward Social. Holding the earlier mix fixed gives 11.1%, which helps describe the composition effect but does not prove a causal outcome. I would examine acquisition costs and customer quality before recommending a checkout rollback.”
That answer separates a verified calculation, an interpretation and an action requiring further evidence.
Practice checks
- Give each channel 500 sessions in both periods and preserve its rate. The pooled rates become 6% and 7.5%.
- Multiply every count by ten. Both pooled percentages must remain unchanged.
- Check that converted sessions never exceed eligible sessions and no session belongs to two channels.
- Show missing channel classifications explicitly instead of silently dropping them.
Continue with revenue-drop investigation, cohort retention and business case-study practice. For coached preparation, review interview plans and current availability. All interview sessions and feedback are in English.