Invoice Profit (Line-Level, Vendor-Attributed)
A Power BI model that calculates invoice profitability with drilldown to item lines, reliable vendor attribution, and clean COGS + freight/charges handling from Business Central.
Summary
Business Impact
Gallery
Screenshots and artifacts from the build (sanitized where needed).
Invoice lines do not reliably return Buy-from Vendor via web services, so vendor attribution was standardized to: Vendor = current (primary) vendor on the Item Card. Mapping occurs at the invoice line level using Item No → Item Card → Vendor_No to support filtering and rollups by Vendor No/Vendor Name.
The profit model was shifted to a line-based fact table so invoices can be summarized at the invoice level while still supporting drilldown into item-level detail (critical when invoices include items from multiple vendors).
COGS comes from Value Entries (Cost_Amount_Actual). Because cost posts at the item + document reference grain, COGS was aggregated by InvoiceNo + Item No and allocated across duplicate invoice lines for the same item on the same invoice when applicable.
Freight/charges are Account lines, so charges are summarized at the invoice level (not forced onto item lines). Some invoices contain freight lines where LineAmount = 0 but UnitPrice holds the real charge, so the rule was updated to: Charge Amount = UnitPrice (fallback to LineAmount) and Qty is ignored due to inconsistent behavior.
- Relationship: DimDate[Date] → Fact_InvoiceProfitLines[PostingDate] (one-to-many, single direction, active).
- Added slicers for Vendor and Sales Person.
- Converted the profit view to a Matrix so users can drill invoice → item.
- Invoice Count
- Total Revenue
- Total Charges
- Total Net Revenue
- Total COGS
- Total Profit
- Total Losses (sum of negative profit)
- Profit Margin %
DAX Library
Search and review the KPI logic used in this model (sanitized).