Monthly revenue in Magento

Magento order revenue grouped by month from the sales_order table.

Magento · PostgreSQL
SELECT to_char(so.created_at, 'YYYY-MM') AS month,
       COUNT(*) AS orders,
       ROUND(SUM(so.base_grand_total), 2) AS revenue
FROM sales_order so
GROUP BY month
ORDER BY month DESC
LIMIT 24;

How it works

Buckets orders by created_at and sums grand_total in the base currency.

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