Buyers making up 60% of revenue: platforms, Mar 2025
Instructions
For each value of users.platform (platform) consider the buyers of this group. A buyer's revenue is the sum of purchases.amount of their purchases made on or after March 1, 2025 and strictly before April 1, 2025. The group's total revenue is the sum of the revenues of its buyers for the same period (the share is computed from the revenue of the buyer's own group, not of all users together). Order the group's buyers by revenue descending (for equal revenue, by the smaller user_id) and take the minimum number of the first of them whose total revenue is at least 60% of the group's total revenue. Output platform, buyers_cnt (how many buyers the group has in total), users_cnt (how many buyers are in this selection) and revenue, the total revenue of these buyers, rounded to 2 decimal places. Do not output groups without purchases. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
events.→user_id users.id - N:1Many-to-one
purchases.→user_id users.id
Table data
Select a table in the diagram or list to view its rows.