Repeat purchase rate in Magento

Share of Magento customers (by email) who ordered more than once.

Magento · PostgreSQL
SELECT ROUND(100.0 * COUNT(*) FILTER (WHERE n > 1) / NULLIF(COUNT(*), 0), 1) AS repeat_rate_pct
FROM (
  SELECT customer_email, COUNT(*) AS n
  FROM sales_order
  WHERE state IN ('complete', 'processing') AND customer_email IS NOT NULL
  GROUP BY customer_email
) y;

How it works

Counts orders per customer email across complete and processing orders, then the percentage with more than one — a core retention KPI.

Run this on your own database

BeQuery mirrors your Magento MySQL database to an isolated PostgreSQL copy, so you can run queries like this one without ever touching production.

Start free No credit card