Meta's Product Growth team is reviewing January 2021 conversion across countries for a purchase-oriented surface. The dataset below is a denormalized activity snapshot containing active-user events and purchase counts, similar to a product-growth extract used alongside AARRR Funnel reporting.
Write a PostgreSQL query to calculate the percentage of active users in each country who made at least one purchase during January 2021.
country, active_users, purchasers, and purchase_rate_pct, in that order.country ascending.purchase_count values as zero, and count users as purchasers only when purchase_count exceeds zero.| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity-event identifier |
| user_id | INT | Meta user identifier |
| country | VARCHAR(50) | User's country |
| activity_date | DATE | Date of the activity event |
| is_active | BOOLEAN | Whether the event qualifies as active usage |
| purchase_count | INT | Purchases attributed to the user on that event |