Customer lifetime value in Magento
Average lifetime spend per Magento customer (by order email).
Magento · PostgreSQL
SELECT ROUND(AVG(spent), 2) AS avg_lifetime_value
FROM (
SELECT customer_email, SUM(base_grand_total) AS spent
FROM sales_order
WHERE state IN ('complete', 'processing') AND customer_email IS NOT NULL
GROUP BY customer_email
) x;How it works
Totals each customer's order value by email across complete and processing orders, then averages — your average customer lifetime value.
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