Revenue looks great until you subtract FBA fees. This query breaks down referral fees, fulfillment fees, and storage costs by SKU so you can see your real net after Amazon takes its cut.
The question
The SQL Taptic generates
SELECT f.sku, ROUND(SUM(CASE WHEN f.fee_type ILIKE '%referral%' THEN f.fee_amount ELSE 0 END)::numeric, 2) AS referral_fees, ROUND(SUM(CASE WHEN f.fee_type ILIKE '%fulfillment%' THEN f.fee_amount ELSE 0 END)::numeric, 2) AS fulfillment_fees, ROUND(SUM(CASE WHEN f.fee_type ILIKE '%storage%' THEN f.fee_amount ELSE 0 END)::numeric, 2) AS storage_fees, ROUND(SUM(f.fee_amount)::numeric, 2) AS total_fees, ROUND(SUM(i.item_price * i.quantity)::numeric, 2) AS gross_revenue, ROUND( SUM(i.item_price * i.quantity)::numeric - SUM(f.fee_amount)::numeric , 2) AS net_revenue, ROUND( (SUM(i.item_price * i.quantity)::numeric - SUM(f.fee_amount)::numeric) / NULLIF(SUM(i.item_price * i.quantity)::numeric, 0) * 100 , 1) AS net_margin_pct FROM amazon_fba_fees f LEFT JOIN amazon_order_items i ON i.sku = f.sku LEFT JOIN amazon_orders o ON o.amazon_order_id = i.amazon_order_id AND o.purchase_date::date >= DATE_TRUNC('quarter', CURRENT_DATE) AND o.order_status NOT IN ('Canceled', 'Cancelled') WHERE f.sku IS NOT NULL GROUP BY f.sku ORDER BY total_fees 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
Per-SKU breakdown of referral fees, fulfillment fees, storage fees, total fees, gross revenue, net revenue, and net margin percentage — ordered by highest total fees.
Why it matters
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.
FAQ
Generate this automatically
In Taptic Data, you type "Show me total FBA fees by SKU this quarter broken down by fe..." 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