All articles
ecommerce2026-11-09

How to Build a Daily GMV Report Without Specialist Tools

Contents

Every e-commerce manager wants to know how much their store made yesterday. The problem is that "made" means something different to everyone — gross GMV, net GMV, post-returns, with VAT or without. Before you even start building the report, you need to agree on a definition. And then it turns out the data lives in three different places and nobody knows which one is the "real" source.

What GMV Actually Is and Why the Definition Matters

GMV (Gross Merchandise Value) is the total value of transactions processed through a platform — without deducting returns, commissions, or operational costs. It is not the same as net revenue. In practice, I see three variants that clients commonly label "GMV":

  • Gross GMV — the sum of all orders with status "placed," including those later cancelled
  • Confirmed GMV — only orders with status "paid" or "shipped"
  • Net GMV — after subtracting returns and cancellations

Before you write a single line of SQL, call the product manager and ask which number they actually need. You'll save yourself rewriting the report two weeks after go-live.

Data Structure — Where to Source Order Data

In a typical e-commerce setup, order data lands in several places: the OMS (e.g., Magento, Shopify, WooCommerce), the payment platform database, and — increasingly — a data warehouse in Snowflake or BigQuery fed by an ETL tool like Keboola.

I'll assume you have an orders table in Snowflake with the basic columns. A typical structure looks like this:

-- Table: orders
-- order_id, created_at, updated_at, status,
-- total_gross, total_net, currency, customer_id

If you're working with multiple currencies, you also need an exchange rate table. That's a separate topic, but remember: always report GMV in a single base currency.

SQL Query — Daily GMV Report Step by Step

Below is a simple but production-ready example of a daily GMV report in Snowflake SQL. I use DATE_TRUNC instead of CAST because it handles time zone conversions on timestamps more reliably.

WITH daily_orders AS (
    SELECT
        DATE_TRUNC('day', CONVERT_TIMEZONE('Europe/Warsaw', created_at)) AS order_date,
        status,
        total_gross,
        order_id
    FROM orders
    WHERE created_at >= DATEADD('day', -90, CURRENT_TIMESTAMP())
      AND status NOT IN ('cancelled', 'failed')
),

gmv_daily AS (
    SELECT
        order_date,
        COUNT(DISTINCT order_id)        AS orders_count,
        SUM(total_gross)                AS gmv_gross,
        AVG(total_gross)                AS aov  -- Average Order Value
    FROM daily_orders
    GROUP BY order_date
),

returns_daily AS (
    SELECT
        DATE_TRUNC('day', CONVERT_TIMEZONE('Europe/Warsaw', r.created_at)) AS return_date,
        SUM(r.refund_amount) AS total_returns
    FROM returns r
    WHERE r.created_at >= DATEADD('day', -90, CURRENT_TIMESTAMP())
    GROUP BY return_date
)

SELECT
    g.order_date,
    g.orders_count,
    g.gmv_gross,
    COALESCE(r.total_returns, 0)             AS returns_amount,
    g.gmv_gross - COALESCE(r.total_returns, 0) AS gmv_net,
    g.aov,
    LAG(g.gmv_gross) OVER (ORDER BY g.order_date) AS gmv_prev_day,
    ROUND(
        (g.gmv_gross - LAG(g.gmv_gross) OVER (ORDER BY g.order_date))
        / NULLIF(LAG(g.gmv_gross) OVER (ORDER BY g.order_date), 0) * 100,
    2) AS gmv_day_over_day_pct
FROM gmv_daily g
LEFT JOIN returns_daily r ON g.order_date = r.return_date
ORDER BY g.order_date DESC;

A few notes on the code: NULLIF in the last column protects against division by zero on days with no sales (e.g., public holidays). COALESCE on the returns handles days with no refunds at all — without it you get NULL instead of 0, and the entire row drops out of aggregations downstream.

Automation and Data Refresh

The query itself is only half the battle. A daily report only makes sense if the data is fresh in the morning when the manager sits down to work. Two approaches that work in practice:

Keboola + Snowflake: Set up a transformation in Keboola that runs this query every night at 05:00. Write the result to a table called reporting.gmv_daily. Then connect that table directly to Tableau or Google Looker Studio as a data source. Refresh time: a few minutes, zero manual work.

Without ETL — Snowflake Tasks only: If you don't have Keboola, use native Snowflake Tasks:

CREATE OR REPLACE TASK refresh_gmv_daily
    WAREHOUSE = compute_wh
    SCHEDULE = 'USING CRON 0 5 * * * Europe/Warsaw'
AS
    CREATE OR REPLACE TABLE reporting.gmv_daily AS
    -- (paste the main query from the section above here)
;

Snowflake Tasks are free within your compute costs — you only pay for the warehouse runtime, which is typically pennies for a query like this.

Pitfalls Worth Watching Out For

Time zone — this is the most common mistake. If your OMS server runs on UTC but the store operates in Poland, an order placed at 23:30 Warsaw time will appear in the data as the next UTC day. Always convert the timestamp to the local time zone before DATE_TRUNC. I showed this above using CONVERT_TIMEZONE('Europe/Warsaw', created_at).

Duplicate orders — when joining multiple sources (OMS + payments), the same orders can appear twice. Use COUNT(DISTINCT order_id) instead of COUNT(*), and regularly check for duplicates using HAVING COUNT(*) > 1.

Retroactive status changes — an order placed yesterday can change status to "cancelled" today. If you report on created_at, today's cancellation won't change yesterday's GMV. If you report on updated_at — it will. Both approaches are valid, but pick one and stick with it consistently.

GMV during promotions — during Black Friday, gross GMV can look great while AOV drops. Always show both metrics together — that's exactly why I included the aov column in the query.

---

TL;DR

  • Before you write a single

Want to know where you lose customers?

I'll analyze your funnel and point out what to fix first. The first call is free.

Book a consultation

More articles about data analytics:

Back to blog