Vendor Profitability
Vendor Profitability Dataset
basis_vendorprofit
This data model is a transaction-grain SQL table that consolidates vendor P&L activity across sell-in and sell-out channels into a single, flat model.
Each row represents a single financial or quantity event — an invoice, a co-op charge, a chargeback, etc. — tied to an ASIN, PO, invoice and date (sell-in) or ASIN and date (sell-out).
The key fields on every row are amount (the financial value), quantity (units), invoice_date (the event date), and invoice_date_first (the first invoice date for the PO, useful for grouping all downstream activity related to a purchase order to a single time period).
How it's organized:
Rows are classified via a three-level hierarchy: pl_category → transaction_type / transaction_subtype. These tell you where in the P&L a row belongs.
The source and source_group columns identify the originating column/table from the raw data, which is critical for filtering — for example, source = 'Rebate in Agreement Curr' isolates the co-op billing amount within a distributor agreement.
What types of activity it covers:
- Sell-in: invoiced amounts, distributor co-op rebates, invoice shortages, chargebacks
- Sell-out: customer co-op, net sales
- PO-level metadata: vendor code, distributor, agreement ID/title, currency fields
FX support:
Amounts are stored in original currency (amount) plus converted versions in USD, EUR, and GBP (amount_in_usd, amount_in_eur, amount_in_gbp), all using spot rates at the invoice date.
Important Caveats:
- Expenses are stored as negative values (additive inverse of source data). So co-op charges, chargebacks, and shortages will be negative numbers — you sum them directly into a P&L without flipping signs.
- Amazon provides no connection between sell-in and sell-out activity in vendor data - when a product unit is sold, the precise economic history of that unit from the sell-in side is not known. Building a comprehensive unit P&L therefore requires modeling techniques. For instance, a modeled unit P&L could be built by calculating per-unit expenses for sell-out and applying those costs to a sell-in P&L that offsets expenses against income from invoicing activity. Or, per-unit sell-in expenses could be applied to a sell-out P&L that uses shipped COGS as income.
Business questions & scenarios
What is this data useful for?
- Vendor P&L by ASIN, PO, time period, or agreement
- Per-unit economics (sell-in units from
transaction_subtype = 'Invoiced Amount', sell-out units from'Shipped COGS'). See above for caveats. - Co-op analysis by agreement, broken out by sell-in vs. sell-out
- Multi-currency reporting with pre-built FX conversion
Schema & update details
| UI Report path | N/A |
| Amazon update frequency | Daily |
| Reason update frequency | Daily |
| Time Zone | Country local time zone |
| Granularity [?] | 1 row per:
-Partner UUID -ASIN -Purchase Order Number -Invoice Number -Agreement ID -Invoice Date |
Historical data & change management
| Time Period | |
| History available from Amazon | 3 years |
| Reason lookback period | 30 days |
Data dictionary: fields in this table
Report Name: Vendor Profitability · Table: basis_vendorprofit · Type: Vendor, Derivative
| Column | Data Type | Description |
|---|---|---|
| marketplace | Number | As determined by most frequent marketplace value found in invoices_summaryv2 |
| source_group | Number | Data source group (used for filtering in AVN dashboard) |
| transaction_type | Number | Transaction type used in AVN P&L classification |
| transaction_type_original | Number | passthrough of transaction_type from distributor or customer co-op tables |
| _created_on | timestamp with time zone | Date the record was created |
| invoice | Number | Secondary invoice reference (distributor coop) - usually NULL |
| price_protection_day | Number | pass-through from payments_distributor_shipment_details |
| title | Number | Title of product |
| quantity | Double Precision | Quantity (units) |
| agreement_title | Number | Title of Co-op agreement or similar reference |
| price_protection_agreement | Number | pass-through from payments_distributor_shipment_details |
| _partneruuid | Character Varying | Partner Unique Identifier |
| vcogs_per_unit | Integer | Vendor COGS per unit (not currently implemented) |
| source_quantity | Number | Data source of quantity value for row |
| invoice_date | timestamp with time zone | Invoice date (for either a vendor invoice or co-op invoice), or an event date (e.g. chargeback date) |
| asin | Number | Amazon Standard Identification Number. The product this data applies to. |
| amount | Double Precision | Numerical amount for row |
| pl_group | Number | P&L group (used for filtering in AVN dashboard) |
| _last_updated_on | timestamp with time zone | Date the record was last updated |
| cost_currency | Number | Currency of product cost on purchase order |
| invoice_day | Number | pass-through from payments_distributor_shipment_* tables (often null) |
| source | Number | Reference to original data source or column |
| _input_key | Character Varying | Internal Reason Automation data key |
| amount_in_usd | Double Precision | Amount converted to USD based on the spot rate for the invoice date |
| agreement_currency | Number | Currency of agreement |
| vendor_code | Number | Vendor Code from PO |
| id | bigint | Unique number assigned to every line in the table |
| po_in_invoices_details | Integer | Does the PO number exist in invoices_detailsv2 (used by AVN dashboard) |
| transaction_subtype | Number | Transaction subtype used in AVN P&L classification |
| agreement_id | Number | Co-op agreement unique ID |
| invoice_id | Number | Unique ID of the invoice |
| amount_in_gbp | Double Precision | Amount converted to GBP based on the spot rate for the invoice date |
| asin_uuid | Number | ASIN-UUID concatenation (used for analytics) |
| _row_index | Integer | Row index |
| invoice_date_first | timestamp with time zone | Date of first invoice event for a given PO |
| distributor | Number | Distributor code |
| amount_in_eur | Double Precision | Amount converted to EUR based on the spot rate for the invoice date |
| _revision | Integer | Number of times the record has changed |
| po_or_order_number | Number | Purchase order or Order Number |
| purchase_order_currency | Number | Currency of purchase order |
| table_source | Number | Exact table source for data |
| amount_raw | Double Precision | pass-through of raw value for amount |
| po_in_ocp | Integer | Does the PO number exist in orders_confirmed_pos (used by AVN dashboard) |
| pl_category | Number | The top P&L category for the row |
How to query this table
Sell-In Co-Op Rebate and Net Receipts by Agreement
This query filters results based on ‘source’ , which usually is a reference to the column from which data was sourced. In the case of distributor co-op tables, amount where source = ‘Rebate in Agreement Curr’ is the co-op amount that was billed, and amount where source = ‘Net Receipts’ is the total value of inventory used in determining rebate for the particular agreement. Transaction_subtype is a commonly used aggregation level in the AVN dashboard.
select
_partneruuid
, transaction_subtype
, agreement_id
, agreement_title
, sum(case when source = 'Rebate in Agreement Curr' then amount else 0 end) as rebate_in_agreement_currency
, sum(case when source = 'Net Receipts' then amount else 0 end) as net_receipts_coop
from basis_vendorprofit
where 1=1
-- edit date range as needed (currently FY 2024)
and date_trunc('year', invoice_date) = '2024-01-01'
group by 1,2,3,4
Sell-Out Co-Op Rebate by Agreement
This query filters results based on ‘source’ , which usually is a reference to the column from which data was sourced. In the case of distributor co-op tables, ‘Rebate in Agreement Curr’ is the co-op amount that was billed, and ‘Net Receipts’ is the total value of inventory used in determining rebate for the particular agreement.
select
_partneruuid
, source_group
, transaction_type
, transaction_subtype
, agreement_id
, agreement_title
, sum(case when source = 'Customer Co-Op' then amount else 0 end) as rebate_in_agreement_currency
, sum(case when source = 'Customer Net Sales' then amount else 0 end) as net_sales
from basis_vendorprofit
where 1=1
and date_trunc('year', invoice_date) = '2024-01-01'
and lower(transaction_type) like '%customer co-op%'
group by 1,2,3,4,5,6
Per-Unit Calculations
The ‘Unit Economics P&L’ in BASIS Negotiation uses different values for units as the denominator for per-unit calculations, depending on whether the expense relates to sell-in or sell-out activity. The following query shows how to compute similar per-unit values directly from the model table.
select
_partneruuid
, asin
, title
, sum(case when source = 'Customer Co-Op' then amount else 0 end) as sell_out_coop
, sum(case when transaction_subtype = 'Shipped COGS' then quantity else 0 end) as sell_out_units
, sum(case when source = 'Rebate in Agreement Curr' then amount else 0 end) as sell_in_coop
, sum(case when transaction_subtype = 'Invoiced Amount' then quantity else 0 end) as sell_in_units
from basis_vendorprofit
where 1=1
and date_trunc('year', invoice_date_first) = '2024-01-01'
group by 1,2,3
On this page
Related pages