Field note · February 18, 2024
seats_now by region: a 20% spread
Real group means for one column across 4 segments, and what the pooled average conceals.
Breaking seats_now down by region on saas-subscriptions, because the headline average is 59 and no segment is actually there.
LATAM— mean 65, median 10 (167 rows)EMEA— mean 64, median 10 (744 rows)AMER— mean 56, median 8 (1,162 rows)APAC— mean 54, median 8 (427 rows)
Top to bottom that is 65 against 54, a spread of 20.0%. The pooled average is 59.
select region,
count(*) as rows,
round(avg(seats_now)::numeric, 2) as mean,
percentile_cont(0.5) within group (order by seats_now) as median
from saas_subscriptions
group by 1
order by mean desc;The groups are close enough that the pooled average is a fair summary. That is worth confirming rather than assuming: the check costs one query and the failure mode is invisible.
Notice the mean and median columns disagree most in LATAM, where the mean sits well above the median. Always compute both in the group-by. The comparison between them per segment is free and tells you whether you are looking at a level difference or a tail difference.
This is the setup for Simpson's paradox — the case where every segment moves one way and the total moves the other.