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.
This is part of the Taptic Data Amazon query library. Explore related queries: SQL query for Amazon return rate by SKU, SQL query for Amazon net margin after FBA fees, SQL query for Amazon buy box percentage by ASIN, and more.
The question
The SQL Taptic generates
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
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. This type of analysis is commonly used in amazon fba analytics and settlement reconciliation.
How this query works
What it returns
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.
Why it matters
New to this metric? How to calculate Amazon net margin after FBA fees — definition, formula, and business context.
All queries and use cases on this page relate to analyzing your Amazon Seller Central data in Taptic. To see the full analytics workflow, explore amazon fba analytics, settlement reconciliation, multi-channel analytics.
FAQ
Generate this automatically
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/moNo credit card required. Connect your data source in under 5 minutes.
Related use cases
Compare tools