DataMosaic

Blog · How-to

Data reconciliation best practices: seven, and what each prevents

Agree the key, compare at the grain people read, count before you join, write the tolerance down, run it on a schedule, keep the evidence and give every difference an owner.

#Where these practices come from

Most lists of best practices say "automate", "ensure data quality" and "establish governance", and stop there. This one pairs each practice with the failure it prevents, shown on one invented chain with 120 stores that compares its till system with its ERP every day, and gives the query where a query helps.

The techniques themselves, from row counts to row hashes, are in data reconciliation: techniques and a worked retail example. How to balance every load inside a pipeline is in data reconciliation in ETL. This post is about the habits around them, the ones that decide whether anybody believes the result.

The examples use two tables: till_sales with one row per store, department and business_date, and erp_sales with one row per store, department and posting_date. The queries are SQL Server; PostgreSQL notes follow where the syntax differs.

#1. Agree the key before comparing

The failure it prevents: a false match, or a false gap. The tills write store codes as ST-014. The ERP's journal, it turns out, writes 14. A join on store finds nothing in common, and every store looks missing from both sides. The quieter version is worse: a key that is unique on one side and duplicated on the other, so a join doubles some rows and the totals look almost right.

Before the first comparison, agree three things with whoever owns each system: which columns name a row, what format each one is in, and that the combination is unique on both sides. Then prove it.

-- Keys that appear more than once: run on both tables
SELECT store, department, business_date, COUNT(*) AS copies
FROM till_sales
GROUP BY store, department, business_date
HAVING COUNT(*) > 1;

-- Store codes on one side only: run both ways
SELECT store FROM till_sales
EXCEPT
SELECT store FROM erp_sales;

Both run as written on SQL Server and PostgreSQL. If the second query returns every store, the formats differ: fix them once in a view, not in every query.

Agree what each column means, too, not only what it is called. At the same chain, a column called CUST_GENDER holds RETAIL, WEB, PARTNER and OUTLET. It is the sales channel. Anyone who compares it with the e-commerce platform's customer gender gets nonsense, and anyone who leaves it out misses that web orders are posted to the wrong channel.

#2. Reconcile at the grain people read

The failure it prevents: a shortage hidden by a surplus. On one Tuesday the chain's total net sales agreed to the cent. Underneath, ST-014 was 480.00 short in the ERP and another store was 480.00 over, because a batch of ST-014's sales had been posted against the wrong store code. A chain-wide total would have passed. Both store managers' reports were wrong.

Compare at the level the people who use the numbers read them. In retail that is usually store by day, and store by department by day for a buyer or a finance team. Finer than both systems keep is impossible; coarser lets differences cancel out. Totals are a first test, never the last.

#3. Counts and totals before rows

The failure it prevents: a diff nobody can read. A row-by-row comparison of a day's receipts across 120 stores produces thousands of lines when one store's upload failed, because every receipt in that store is missing. The one fact that matters, that ST-022 is absent, is buried.

Start with one row per store: the count of lines and the sum of the measure on each side. That answers "which stores?" in seconds. Go down to rows only for the stores that differ.

DECLARE @day date = '2026-11-10';

WITH t AS (
  SELECT store, COUNT(*) AS lines, SUM(net_sales) AS net
  FROM till_sales
  WHERE business_date = @day
  GROUP BY store
),
e AS (
  SELECT store, COUNT(*) AS lines, SUM(net_sales) AS net
  FROM erp_sales
  WHERE posting_date = @day
  GROUP BY store
)
SELECT COALESCE(t.store, e.store) AS store,
       t.lines AS till_lines, e.lines AS erp_lines,
       t.net AS till_net, e.net AS erp_net,
       COALESCE(t.net, 0) - COALESCE(e.net, 0) AS difference,
       CASE WHEN e.store IS NULL THEN 'only at the tills'
            WHEN t.store IS NULL THEN 'only in the ERP'
            WHEN t.lines = e.lines AND ABS(t.net - e.net) <= 0.05 THEN 'match'
            ELSE 'differs' END AS status
FROM t
FULL OUTER JOIN e ON e.store = t.store
ORDER BY ABS(COALESCE(t.net, 0) - COALESCE(e.net, 0)) DESC;

The full outer join keeps stores that are on one side only; an inner join would drop exactly the store you are looking for. Ordering by the size of the difference puts the money at the top. In PostgreSQL, delete the DECLARE line and write DATE '2026-11-10' in place of @day both times.

#4. A tolerance written down

The failure it prevents: a list everyone learns to ignore. ST-031 differs by 0.04 most days, because the tills round tax per line and the ERP rounds per receipt. If the check flags it every morning, people learn that the list always has something on it, and stop reading it. The day ST-014 is 480.00 out, it sits on the same list as the rounding.

Decide the tolerance for each measure once, write down why, and put it in the check, not in someone's head:

MeasureToleranceWhy
Net sales per store per day0.05Tax rounded per line at the tills, per receipt in the ERP
Line count per store per day0A line is there or it is not
Units per store per day0Units are whole numbers on both sides

Start at zero and loosen only with a reason you can write in that third column. A tolerance of 25.00 that nobody can explain tells the next person 25.00 is fine.

#5. A schedule, not a request

The failure it prevents: a gap found weeks late. At the chain, the reconciliation used to run when finance asked for it, which was at month end. ST-022's day of 6,410.75 had failed to reach the ERP on the 10th. It was found on the 31st, when the till files for that day had been archived and the store's staff had moved on to other things.

Run the comparison every day, after the last store's upload is due and before anybody reads the numbers. Two details make a scheduled run trustworthy:

  • Fail on an empty result. A source that returned nothing gives zero differences and looks perfect. A run that compared no rows is a failure, not a pass.
  • Run in the business's time zone. A schedule on a server in another time zone compares the wrong day for part of the estate.

#6. Keep the evidence

The failure it prevents: a question nobody can answer. In March an auditor asks whether the difference at ST-014 in November was found, and what was done about it. The spreadsheet that answered it was overwritten the next morning.

Keep, for every run: when it ran, what it compared, the counts and the differences, which rules passed, and the note that says what happened. A table is enough to start:

CREATE TABLE recon_result (
  run_at        datetime2(0)  NOT NULL DEFAULT SYSDATETIME(),
  business_date date          NOT NULL,
  store         varchar(10)   NOT NULL,
  till_net      decimal(12,2) NULL,
  erp_net       decimal(12,2) NULL,
  status        varchar(20)   NOT NULL,
  owner         varchar(50)   NULL,
  what_happened varchar(400)  NULL
);

In PostgreSQL, write timestamp(0) for datetime2(0) and now() for SYSDATETIME(). Insert the store-level query's output into it after each run. Keep "resolved" and "accepted" apart in status: one says the difference went away, the other says it is still there and somebody decided to live with it. An auditor will ask which.

#7. Send the result to an owner

The failure it prevents: a difference everyone saw and nobody fixed. The result went to a shared mailbox read by six people. Each assumed one of the others had picked up ST-014. Nobody had.

Every kind of difference needs one named owner: a store missing from the ERP belongs to whoever runs the interface, a value refused by the ERP to whoever looks after its master data, a till that did not upload to store systems. Send the result only when something differs, so that a message means something, and send it to the person who can act on it.

#The worked example: one Tuesday, with all seven in place

The same invented chain, Tuesday 10 November, compared at store by day, counts and totals first, with the tolerance from the table above.

StoreTills: linesERP: linesTills: netERP: netDifferenceStatusOwner
ST-02218none6,410.75none6,410.75Only at the tillsInterfaces
ST-014201712,400.0011,920.00480.00DiffersERP master data
ST-03119197,215.347,215.300.04Match, within 0.05None
ST-004212118,250.6018,250.600.00MatchNone
ST-01116169,874.109,874.100.00MatchNone

Invented figures. Of 120 stores, two need somebody, and each has a name next to it. ST-022 is missing entirely, so the question is whether its day reached the ERP's interface, and the interfaces team gets it. ST-014 has three lines fewer in the ERP, worth 480.00: the ERP refused three lines with no tax code, which is a master data fix. ST-031's four cents are inside the written tolerance and ask for nothing, so nobody's morning starts with them. The other 116 stores match and do not appear in anybody's inbox. The two causes are the same two behind most POS and ERP sales differences.

#Where doing it by hand runs out

The queries above work. Keeping them working is the hard part: a scheduled job per pair of systems, a results table that grows, an email that needs writing, and a spreadsheet of who owns what. When the two systems are on different servers or different engines, one query cannot join them at all, and the reconciliation goes back to two exports and a VLOOKUP.

That is what DataMosaic is for. A check reads both systems where they are, lines the rows up on the key you agree, and shows which match, which differ and which are missing. Each measure carries its own tolerance. Rules decide when a run fails: rows that differ, at most 0 is the first one, and rows compared, at least 1 turns a silently empty source into a failure. A trigger runs the check on a schedule in the workspace's time zone and can notify only when something differs. History keeps every run's counts and rule outcomes, and a difference that survives a run becomes an exception with a status, an owner, a note and its own history (from the Pro plan up). On a differing row, an investigation walks through why the two systems can disagree. A check only reads: Mosaic acts on a system only through a workflow you build, such as sending a store's batch again and running the check again.

#Questions people ask

#What are the best practices for data reconciliation?

Agree a unique key with each system's owner, compare at the level people read the numbers, run counts and totals before row-by-row comparison, write each tolerance down with its reason, run on a schedule, keep the evidence of every run, and send each difference to a named owner.

#How often should data reconciliation be done?

As often as the data changes and someone relies on it. For live systems such as a till system and an ERP, that is every day, after the last upload is due, so a gap is found while the files and the people who can explain it are still there.

#What tolerance should a reconciliation use?

Zero, unless there is a reason you can write down, such as tax rounded per line on one side and per receipt on the other. Counts usually take a tolerance of zero; amounts may take a cent or a few cents.

#How do you document a reconciliation for audit?

Keep a record for every run: when it ran, what it compared, the counts and differences, which rules passed, and a note on what was done about each difference. Keep "resolved" separate from "accepted as it is", because an auditor will ask which one it was.

#Why do totals match when the data doesn't?

Because differences cancel out. A shortage at one store and a surplus at another, or a lost row and a duplicated one, leave the total unchanged. Compare at a finer grain, such as store by day, to see them.

Stop comparing exports by hand.

DataMosaic checks the systems themselves overnight, tells you why they differ, and runs the fix you've set up, before anyone else notices.