Skip to content

Build a reporting data model that avoids double counting

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 ID Shared reference
  • Order
  • Shipment
  • Invoice
  • Payment
Each record has its own row and ID. The order ID links the records for reporting.

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.

More articles.

  1. Write metric definitions that two departments can use

    Define the event, date and exceptions behind a KPI so people can trace it to records and explain differences between reports.

  2. Reconcile an accounting sync at the record level

    Give finance a daily way to match invoices and credits, separate timing differences from errors, and confirm every correction.

  3. Give an AI analyst read-only access people can trust

    Limit which records an AI reporting assistant can read, and preserve those limits in answers, exports, caches and logs.

All articles

Want a second opinion on your project?

Book a call and we’ll talk through your options.

JurajCEO, QikBuild

You leave the call with

  • What we would build first
  • A rough price range
  • Whether custom software makes sense for you
Book a 30-minute call

Or write to hello@qikbuild.com