mediumonline store · Q4
aggregationconditional countspercentages

Repeat buyers by country

For each country, work out how many customers came back to buy again.

  • buyers is the number of customers in that country with at least one completed order
  • repeat_buyers is how many of them have two or more completed orders
  • repeat_rate = 100 * repeat_buyers / buyers, rounded to 1 decimal place
  • only include countries with at least one buyer. Guest orders (no customer) don't belong to any country.
output columns
countrybuyersrepeat_buyersrepeat_rate

uses ,

ctrl + enter to run on the sample data · ctrl + shift + enter to submit

run your query to see the output here. Submit checks it against the sample data, hidden test cases, random data and a large dataset.