Magento SQL Average Order Value

I need to get the AOV from our store.

Simple SQL code is as follows:

SELECT SUM( grand_total ) / COUNT( * )
FROM `mg_sales_flat_order`
WHERE mg_sales_flat_order.status NOT LIKE ‘canceled’
AND mg_sales_flat_order.status NOT LIKE ‘closed’
AND mg_sales_flat_order.status NOT LIKE ‘fraud’
AND mg_sales_flat_order.status NOT LIKE ‘holded’
AND mg_sales_flat_order.status NOT LIKE ‘paypal_canceled_reversal’

Instead of using grand_total there are a couple of other things you can do which are as follows:

grand_total = product rev + ship – discount inc tax

base_subtotal & subtotal = product revenue exc tax

base_subtotal_incl_tax & subtotal_incl_tax  = product revenue inc tax

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.