Homeโ€บQuery Libraryโ€บShopify

How is your Shopify revenue trending month over month?

The first question every Shopify merchant asks โ€” answered cleanly from your orders table with correct paid-order filtering and period-over-period comparison.

๐Ÿ“Š Shopify๐Ÿ‘ฅ Shopify merchants๐Ÿ”ค Plain-English โ†’ SQL
Part of the Explore all Shopify analytics queries โ†’

This is part of the Taptic Data Shopify query library. Explore related queries: SQL query for Shopify revenue by month, SQL query for Shopify customer lifetime value, SQL query for Shopify refund rate by product, and more.

Show me monthly Shopify revenue for the last 12 months with order count and average order value
โ†“
Shopify Revenue by Month โ€” generated by Taptic Data AI
SELECT
  TO_CHAR(DATE_TRUNC('month', o.created_at), 'YYYY-MM')  AS order_month,
  COUNT(DISTINCT o.id)                                    AS orders,
  COUNT(DISTINCT o.customer_id)                          AS unique_customers,
  ROUND(SUM(o.total_price)::numeric, 2)                  AS gross_revenue,
  ROUND(SUM(o.total_price)::numeric
    / NULLIF(COUNT(DISTINCT o.id), 0), 2)                AS avg_order_value,
  ROUND(SUM(o.total_price - o.total_refunded)::numeric, 2) AS net_revenue
FROM shopify_orders o
WHERE o.financial_status IN ('paid', 'partially_refunded')
  AND o.created_at >= NOW() - INTERVAL '12 months'
GROUP BY DATE_TRUNC('month', o.created_at)
ORDER BY 1 ASC
Schema-aware SQL generated from plain English13 lines

This query was generated by Taptic Data from plain English against a real Shopify schema. In Taptic, you type the question โ€” the AI writes the SQL, runs it, and returns the result. You can edit the SQL, ask for explanations, and save it as a refreshable report. This type of analysis is commonly used in shopify revenue dashboard and multi-channel analytics.

Breaking it down line by line

  1. Filters to paid and partially_refunded orders โ€” the orders that actually contributed revenue
  2. Includes both gross revenue (pre-refund) and net revenue (total_price minus total_refunded) in the same row
  3. Counts unique customers per month alongside orders to distinguish AOV changes from customer mix changes
  4. Truncates to month and formats as YYYY-MM for clean chart display
  5. NULLIF prevents division by zero in the AOV calculation for any month with zero orders

Result description

Monthly table with order count, unique customers, gross revenue, average order value, and net revenue after refunds โ€” 12 months in chronological order.

The business impact

Monthly revenue is the heartbeat metric for any Shopify store. Seeing gross vs net side-by-side lets you spot whether a revenue dip is real or just a refund spike. Tracking unique customers vs orders reveals whether you're growing through acquisition, repeat purchases, or AOV improvements.

All queries and use cases on this page relate to analyzing your Shopify data in Taptic. To see the full analytics workflow, explore shopify revenue dashboard, multi-channel analytics.

Common questions

How do I generate a "Shopify Revenue by Month" query automatically?
In Taptic Data, type "Show me monthly Shopify revenue for the last 12 months with order count and average order value" and the AI generates schema-aware SQL against your real Shopify data โ€” no manual writing required.
What database does this query work with?
This query is designed for Shopify. Taptic reads your live schema so the generated SQL always matches your actual table and column names.
Can I edit the generated SQL?
Yes. Taptic shows you the exact SQL it generated. You can edit it directly, ask the AI to explain any line, or request a revision in plain English.
Can I save this as a scheduled report?
Yes. Once you run this query in Taptic, you can save it as a report, add charts and KPIs, and schedule it to email your team on any cadence โ€” daily, weekly, or monthly.

Skip the SQL. Ask the question.

In Taptic Data, you type "Show me monthly Shopify revenue for the last 12 months with ..." and this SQL runs automatically against your real Shopify data.

Try Taptic Free โ€” $29.99/mo

No credit card required. Connect your data source in under 5 minutes.

Next step
Run this query on your own Shopify data
Connect ๐ŸŸข Shopify to Taptic Data and this SQL generates automatically from plain English โ€” against your real schema, your real tables.
Analytics hub
More Shopify queries, use cases, and analytics resources in one place.
Explore all Shopify analytics queries โ†’