
Ask a sales director two questions: which customers and items really make money, and are we shipping on time and in full? Dynamics 365 Finance & Operations (D365 F&O) holds every answer, but not on one screen. Margin needs the invoice and the cost of the stock that left the warehouse. OTIF needs the order line, its promised date and the packing slip. They are three different screens and eight different tables.
This is module 1 of our D365 F&O series. Each module follows the same path: the screens your team already uses, the tables behind them, one T-SQL notebook in Microsoft Fabric, and a Power BI report. The platform underneath (Fabric Link, the Bronze, Silver and Gold layers) is covered in D365 F&O to a Power BI board pack in Microsoft Fabric.
Watch: D365 sales, from the screen to Power BI
Key takeaways
- Right-click any D365 field and choose Form information to find the table and field behind it.
- Eight tables carry sales margin and OTIF: SalesTable, SalesLine, CustPackingSlipTrans, CustInvoiceJour, CustInvoiceTrans, InventTransOrigin, InventTrans and SRSAnalysisEnums.
- True margin uses the inventory cost actually posted against each invoice (InventTrans via InventTransOrigin), not the item’s standard cost.
- D365 stores empty dates as 1 January 1900. Unhandled, OTIF read 76%; fixed once in Silver, it is 96.8%.
- The demo shows £116.8M of revenue at a 47.4% margin and 99.8% OTIF year to date, and the revenue ties to the finance pack within 14p.
Where sales lives in Dynamics 365

Your sales team lives in Sales and marketing › Sales orders › All sales orders. Each row is a sales order header, stored in SalesTable: customer, order type, status and dates. Open an order and the lines underneath are SalesLine records: item, quantity, price, and the requested and confirmed ship dates that OTIF depends on.
Form information: the table behind any field

The quickest way to map a screen to the data is built into D365. Right-click any field and choose Form information. On a sales order line, the quantity is control SalesLine_SalesQty, which is the SalesQty field of the SalesLine table. Every number in a report can be traced back to its screen this way.
From order to cash: the screens and their tables

| D365 screen | Table | What we use it for |
|---|---|---|
| All sales orders | SalesTable | Order header, customer, order date |
| Sales order lines | SalesLine | Item, quantity, price, requested and confirmed ship dates |
| Packing slip journal | CustPackingSlipTrans | What actually shipped, and when |
| Invoice journal (header) | CustInvoiceJour | Invoice account and date |
| Invoice journal (lines) | CustInvoiceTrans | Revenue per invoice line, in accounting currency |
| Inventory transactions | InventTrans + InventTransOrigin | Cost actually posted when stock left the warehouse |
| (status labels) | SRSAnalysisEnums | Turns status 3 into Invoiced |
How the tables join

Four keys do almost all the work. Orders join to lines on SalesId. Lines, packing slip lines and invoice lines share the lot ID, InventTransId. Invoice lines find their header through ParentRecId. And InventTransOrigin links each lot to the inventory transactions that carry the posted cost. Every table is filtered on company (DataAreaId) and on Fabric Link’s soft-delete flag (IsDelete).
Where it lives in Fabric

Fabric Link replicates each of these tables into OneLake, and the Bronze lakehouse exposes them as Lakehouse_Bronze.d365.<table>. SalesLine alone has 280 columns. For margin and delivery performance you need about fifteen, which is why the Silver layer exists: it keeps the columns that matter, with business names.
The gotcha: empty dates are not empty

D365 stores a blank date as 1 January 1900, not as NULL. When we first built OTIF, any order line without a confirmed ship date was compared with 1900. The result: OTIF of 76% and an average of 42,507 days late. One line of SQL, NULLIF(date, '1900-01-01'), applied in Silver, gives 96.8% across all periods, and every report built on Silver inherits the fix. The same trap hits customer due dates, so it matters for aged debt too.
The transformation: one T-SQL notebook cell

The module runs as a T-SQL notebook in Fabric, attached to a warehouse and reading Bronze with three-part names. The cell above is the one that matters. Revenue comes from the invoice line (CustInvoiceTrans.LineAmountMST). Cost comes from the inventory issue: the cost posted in InventTrans against that invoice and lot, found through InventTransOrigin. It is the actual cost of the goods that left the warehouse, not the item’s standard cost.
In the demo data, 99.8% of invoice lines (185,444 of 185,605) match an inventory issue cost. Gold then turns Silver into a star schema in pounds sterling, using month-end exchange rates, and rolls the Contoso demo dates forward nine years so the report reads as the current year.
What you get in Power BI
Sales margin

Year to date: £116.8M of revenue, £61.4M cost of sales and a 47.4% margin, up 11.5% on the prior year. Margin by item group shows where the money is made (cleaning products lead with £19.4M), and the item table shows revenue, cost and margin line by line, with top customers alongside.
Delivery performance (OTIF)

Each shipped line is compared with its promised ship date (confirmed, else requested) and ordered quantity. Year to date, OTIF is 99.8%: 3,874 lines shipped and 8 late, by an average of one day. The trend, the legal entity view and the customers with the most late lines point to where to look, and the shipped-lines table shows every line with its promised and actual date.
Proof it’s right: it ties to the ledger

Invoiced revenue in the sales module is £116,772,515.75 year to date; the finance board pack shows £116,772,515.89 from the general ledger. They agree within 14p. The margin is also more believable than the ledger’s: the Contoso demo ledgers post very little cost of sales (a 97% gross margin), while posted inventory cost gives 47.4%.
Prerequisites
- Dynamics 365 Finance & Operations (Supply Chain Management for the sales and inventory tables) linked to Microsoft Fabric with Fabric Link.
- The eight tables above selected in Fabric Link (they appear in Bronze automatically through the schema shortcut).
- A Fabric capacity for the warehouse, the T-SQL notebook and the Direct Lake semantic model.
- Power BI Pro for report authors (and for viewers on capacities smaller than F64).
Next in the series
Module 2 covers inventory: value at any date, stock ageing and the inventory-to-general-ledger reconciliation, built from InventTrans, InventDim and InventSum. Later modules cover accounts payable controls, commerce, projects, procurement and production.
Frequently asked questions
Which D365 tables hold sales orders and invoices?
Sales order headers are in SalesTable and lines in SalesLine. Packing slips are in CustPackingSlipJour and CustPackingSlipTrans, invoices in CustInvoiceJour and CustInvoiceTrans, and the inventory cost of each shipment in InventTrans, linked through InventTransOrigin.
How do I find which table a D365 field comes from?
Right-click the field in Dynamics 365 and choose Form information. It shows the form, the control and the data source, for example SalesLine_SalesQty for the quantity on a sales order line.
How do you calculate true margin from D365?
Take revenue from the invoice line (CustInvoiceTrans) and cost from the inventory transactions posted against that invoice and lot (InventTrans via InventTransOrigin), rather than the item’s standard cost.
Why is my OTIF so low when I report on D365 data?
D365 stores empty dates as 1 January 1900. If a promised or confirmed date is blank, it is compared with 1900 and the line looks decades late. Treat 1900-01-01 as NULL before calculating OTIF.
Why use a T-SQL notebook instead of PySpark?
For relational joins and aggregations like these, T-SQL on a Fabric warehouse is familiar to most BI teams, reads Bronze tables with three-part names and writes the Silver and Gold tables directly.
Is this real customer data?
No. It is Microsoft’s Contoso demo data for Dynamics 365, with dates rolled forward nine years for illustration.
Sales reporting from your own D365 data
If you run Dynamics 365 Finance & Operations and want margin and delivery performance you can trust, we can give you live access to the demo, share the full sales table map (every table, key and join we used), or talk through your own set-up on a no-obligation discovery call.
Business Intelligence Atlas (Atlas BI) is a UK Microsoft Fabric and Power BI consultancy. The demo uses Microsoft’s Contoso sample data for Dynamics 365; company and customer names are fictional, person names are blurred and dates have been rolled forward for illustration.
Related: D365 F&O to a Power BI board pack in Microsoft Fabric · Dynamics 365 F&O reporting in Microsoft Fabric.
Comments are closed