An order has two shipments and two invoices. Join them all by order ID and you can end up with four rows. A dashboard that sums the rows can overstate both the shipment count and the billed amount without a single extra order being placed.
Keep events linked without treating them as the same row
- Order
- Shipment
- Invoice
- Payment
Say what a row represents
Pick the reporting question first. To compare booked and shipped orders by week, you need an order date and one definition of “shipped”. To see how many parcels left a warehouse, the shipment is the relevant record. Keep those records separate and give them stable keys.
In an illustrative order with invoices of €600 and €400, joining each invoice to both shipments produces an apparent €2,000. Sum the invoices by order first and count the shipments by order separately. Join those summaries to the order when the report needs both values. Its order row can then show two shipments and €1,000 invoiced.
Keep dimensions predictable
When someone changes an account’s region, decide whether the past follows the new region or retains the label it had at the time. Use the current label for operational ownership and a historical label where the report has to match a period that already closed. If people need both, name them explicitly.
Test with records that multiply rows
Use a tiny dataset you can total by hand. Add partial shipments, a split invoice and a credit. Include an order with no shipment yet. Compare both headline and drill-down totals with that dataset whenever the joins change. Fix discrepancies in the model so that every chart benefits from the same rule.