HomeQuery LibraryAmazon

What is your actual net margin per Amazon SKU after all fees?

Revenue is vanity, net is reality. This query combines order revenue, FBA fulfillment fees, referral fees, and returns to show what you're actually keeping on each product.

📊 Amazon Seller Central👥 Amazon FBA sellers🔤 Plain-English → SQL
Show me net margin per SKU after FBA fees, referral fees, and returns for the last 90 days
Amazon Net Margin by SKU — generated by Taptic Data AI
WITH revenue AS (
  SELECT
    i.sku,
    MAX(i.product_name)              AS product_name,
    SUM(i.item_price * i.quantity)   AS gross_revenue,
    SUM(i.quantity)                  AS units_sold
  FROM amazon_order_items i
  JOIN amazon_orders o ON o.amazon_order_id = i.amazon_order_id
  WHERE o.order_status NOT IN ('Canceled', 'Cancelled')
    AND i.item_price IS NOT NULL
    AND o.purchase_date::date >= CURRENT_DATE - INTERVAL '90 days'
  GROUP BY i.sku
),
fees AS (
  SELECT
    seller_sku                        AS sku,
    SUM(item_related_fee_amount)      AS total_fees
  FROM amazon_financial_events
  WHERE charge_type IN ('FBAPerUnitFulfillmentFee', 'Commission')
    AND posted_date::date >= CURRENT_DATE - INTERVAL '90 days'
  GROUP BY seller_sku
),
returns_cost AS (
  SELECT
    sku,
    COUNT(*) * AVG(f.estimated_referral_fee_per_unit) AS estimated_return_cost
  FROM amazon_returns r
  JOIN amazon_fba_fees f USING (sku)
  WHERE r.return_date::date >= CURRENT_DATE - INTERVAL '90 days'
  GROUP BY r.sku
)
SELECT
  r.sku,
  r.product_name,
  r.gross_revenue,
  COALESCE(f.total_fees, 0)          AS total_fees,
  COALESCE(rc.estimated_return_cost, 0) AS estimated_return_cost,
  r.gross_revenue
    - COALESCE(f.total_fees, 0)
    - COALESCE(rc.estimated_return_cost, 0) AS estimated_net,
  ROUND(
    (r.gross_revenue
      - COALESCE(f.total_fees, 0)
      - COALESCE(rc.estimated_return_cost, 0))
    / NULLIF(r.gross_revenue, 0) * 100, 2
  )                                   AS net_margin_pct
FROM revenue r
LEFT JOIN fees f USING (sku)
LEFT JOIN returns_cost rc USING (sku)
WHERE r.units_sold > 5
ORDER BY estimated_net DESC
Schema-aware SQL generated from plain English51 lines

This query was generated by Taptic Data from plain English against a real Amazon Seller Central 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.

Breaking it down line by line

  1. CTE "revenue" sums gross revenue and units per SKU from order_items, filtered to non-cancelled orders
  2. CTE "fees" pulls FBA fulfillment fees and referral commissions from financial_events for the same period
  3. CTE "returns_cost" estimates the cost of returns using the FBA fees table's referral fee estimate
  4. The final SELECT subtracts fees and return costs from gross revenue to produce estimated net per SKU
  5. Net margin percentage is calculated as net / gross * 100, with NULLIF protecting against division by zero

Result description

A ranked table showing each SKU's gross revenue, total fees, estimated return costs, estimated net revenue, and net margin percentage — sorted by highest absolute net to find your most profitable products.

The business impact

Most Amazon sellers know their revenue. Very few know their actual net after referral fees, FBA fulfillment fees, storage fees, and return processing costs. A product doing $50K in revenue at 8% net is dramatically less valuable than a product doing $20K at 35% net. This query makes that visible instantly.

Skip the SQL. Ask the question.

In Taptic Data, you type "Show me net margin per SKU after FBA fees, referral fees, an..." and this SQL runs automatically against your real Amazon Seller Central data.

Try Taptic Free — $29.99/mo

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