Writing

Reporting that can be checked

How one analyst rebuilt and now runs a procurement reporting programme on Power BI, with an AI coding agent as a tool and a person approving every outward step

Summary

In five weeks, one analyst turned the reporting for a procurement programme at a large industrial manufacturer into a service that refreshes, checks and reports on itself every day. The programme covers two areas: the client's existing purchasing data, and a new purchasing platform, live for three weeks when the work began, to which suppliers are being moved.

Three practices matter more than the reports themselves:

  • Figures are recomputed independently from the raw rows, and headline figures a second time by a checker who has not seen the answer.
  • Failures are meant to be seen. Each refresh step reports its own failure, and a separate job reports the checks and refreshes that did not happen at all. The gaps that remain are listed in section 7.
  • Changes are recorded: what was changed, on whose approval, what was verified and what was not.

An AI coding agent (Claude Code) was used as a tool for building and for the daily checks, under fixed rules: it proposes, a person approves, and it never signs in, sends, publishes or deletes on its own word. This paper describes what was built, how accuracy is kept, how the agent was used, and what another team could take from it.

The benefit is described here in words, not in numbers, because no baseline was measured before the work began. The nightly refreshes, the comparison with the other analyst's work and the weekly reports no longer need anyone to start them; a stale or inconsistent report is stopped before its readers see it; and a question about any figure can be answered from the rows that produced it.

1. The starting point

The situation will be familiar to most reporting teams:

  • Reports and their data preparation had grown over time, with business rules spread across queries, measures and spreadsheets.
  • The data preparation for the new platform belongs to another analyst, in another workspace. The reports described here depend on copies of that work, and the original keeps changing.
  • Refreshes ran on separate timers, so a report could read a table before the table was rebuilt.
  • A figure was "right" when it looked right. Nobody could say, for a given number on a page, which rows produced it.
  • Management wanted one question answered every week: of the suppliers the client bought from last year, who has moved to the new platform, and who has not?

2. What was built

Models and reports as text. Every semantic model and report is kept as source files in a Git repository, about 390 commits in five weeks. A change to a model or report is made in the files, checked, and then published with the Fabric command line. Before a publish in place, the live item is exported and compared with the last published version, so a change made by someone else in the service is noticed before it is overwritten. Dataflow queries and Power Automate flows are still changed in the browser; for these, the repository holds the text that was pasted and a record of each change.

Refreshes as chains, not timers. Two chains of Power Automate flows replace the separate schedules:

  • For the new platform, one chain each night refreshes eight dataflows in order, runs a comparison step, and then refreshes three models. Each step starts only when the one before it has succeeded.
  • For the existing purchasing data, the chain starts when the upstream nightly data load finishes, whatever the hour. When that load moved by nearly three hours, the chain followed without anyone changing it.

Monitoring in layers.

Layer What it answers
Failure email per refresh step Which step of a chain stopped, and why
Daily alignment check Do our copies of the other analyst's 164 queries still have the same definitions, and do the shared reference tables hold the same rows?
Daily report comparison Does their published report agree with ours on every order, amount and total?
Watchdog Did the checks themselves run, and did each model refresh today?
Source watcher Which source workbook was edited, and when

The watchdog exists because of a real weekend. The alignment check runs on a desktop computer; for two days it did not run, nothing said so, and a model whose refresh had started failing on the Saturday was only noticed on the Monday. A check that can fail silently is not a check.

Scheduled reporting. Three emails are produced without anyone starting them: a weekly digest of key figures for the internal team; a weekday purchasing digest for the programme team, with a PDF and a workbook on Mondays; and a weekly report to management on the supplier transition, described in section 5. Each one tests the age of its data first. The purchasing digest and the management report are held when the data is stale, or, for the management report, when an internal reconciliation does not come to zero: the author gets a notice, and the readers get nothing rather than something wrong. The internal digest is sent in any case, marked "data behind".

Operations as written procedures. The morning check, the handling of a change from the other analyst, a manual refresh, a publish and a full report review each have a written procedure with the traps learned so far. A handover document says what runs, on whose sign-in, and what to do when each thing stops.

3. How accuracy is kept

Recompute, do not re-read. A measure checked against itself proves nothing. In a review, and before a change to a calculation is published, the raw tables are pulled from the model and each figure is recomputed outside it, from the written definition and not by translating the formula. The comparison is cell by cell, and the target is agreement to the cent.

A second, blind computation for headline figures. A separate verifier is given the question only (which figure, which filters, which model) and never the answer. It works from the raw rows and reports what it finds; only then are the two results compared. The rule is to do this before a figure leaves the team. It has not always been met: one set of totals was published on a Sunday evening and verified the next day. They agreed, and the record says which came first.

Define before you build. The first look at the supplier transition gave a prior-year total about 7% above the figure already published on another page, because it had not applied that page's rules. Nothing was built on it. The definitions were written as a table, agreed on real numbers, and tied to the published total by a reconciliation measure that must equal zero every week or the report is held.

"Same code" is not "correct". The alignment check proves that a copy of a query matches the other analyst's. It says nothing about whether the query is right. So a change of theirs is verified before it is adopted: outputs recomputed from inputs, and logic that today's data cannot reach tested on made-up inputs. What was not verified is stated in the record.

Test the failure paths. For the management report, each of the three notices (held, failed, copy not saved) was produced on purpose by a test build with a step made to fail; the live version was then restored and compared with its source. Two of the three were tested just after the first scheduled send, not before it. One finding: a run whose archive step fails still shows as "Succeeded" in the run history, because the alert handles the failure. Only the test showed that.

Explain every difference. Two examples from one week:

  • Two copies of the same query, on the same data, kept different rows for two suppliers. The cause was a sort on one column with ties: the row kept was left to chance. The other analyst added a full sort key, adopted here after a simulation: 18 suppliers had been exposed to the tie, and the new key settles all of them.
  • The next morning the check raised an alert again. The row-by-row comparison found one cell, for one supplier, and the gap was exactly the value of one purchase order. One side had refreshed six hours after the other the day before, so the likely cause is timing. It is recorded as likely, not proven, with the day it should clear and what it would mean if it does not.

4. The AI agent as a tool

Claude Code is a coding agent that runs in a terminal, reads and writes the repository, runs scripts, and can drive a browser. In this programme it wrote scripts and model changes, ran the daily checks, investigated alerts and kept the records, with the analyst deciding what to build and approving what went out. What made it usable for production work was the set of rules around it:

  • Ask first, every time. Publishing, refreshing, saving a flow or a dataflow, changing a schedule, sending a message and pushing code each need a clear yes from the analyst, for that step. A yes for one publish does not carry to the next.
  • Hard limits. It never signs in or types credentials, never deletes anything in a shared place, never edits the original report files, and never changes the other analyst's workspace. Deleting, sending email and editing those files are also blocked by configuration, not only by instruction.
  • Read-only by default when checking: open a step, never save it.
  • Say what was not verified. Every report of work ends with what was checked, what was not, and every default chosen, so the analyst can overturn any of them.
  • Standing memory. Lessons are written into the procedures (for example: after a dataflow query is changed, its table is empty until the next refresh, so refresh before anything reads it). The next session starts with them.

Two limits. First, the agent makes mistakes of the kind a person does: a click that lands beside the intended button, a time recorded wrongly. The rules above are there for this; the mistakes that were noticed were reported and corrected in the record. Second, the agent does not remove the dependence on one person. Everything still runs on one sign-in, and the handover document names this as the main open risk.

What the agent could reach. The agent ran on the analyst's own computer, under the analyst's own sign-in. It could read what the analyst can read and nothing more; it held no credentials of its own and was never given any to type. It changed nothing in the service without an approval for that step, and the changes it made are in the records. A tool of this kind processes what it reads through its provider's service, so a team adopting the approach should settle first, with its own organisation and its client, which data the tool may read and on what terms.

5. A worked example: the supplier transition report

Management's question was simple; a careless answer would have read as a verdict on named suppliers. What was specific to this report:

  • Definitions that avoid false alarms. A supplier counts as regular, occasional or rare by how many months it ordered in; one that had already gone quiet before the change is shown apart, not counted as a gap. A re-created order counts as coming across, and that choice is shown apart too.
  • One page and one email. The page gives the cut-over, suppliers across and not yet across, new suppliers, the week's movement, and the same breakdown for each ledger. Each Monday it goes out as a PDF with the lists in a workbook, and a copy is archived.
  • Access kept narrow. The readers receive the email, the PDF and the workbook. Nobody on the list has access to the workspace or the interactive report.
  • Verification. The page's totals and each ledger's figures were recomputed by the blind verifier from about 3,200 raw rows, and agreed to the cent. One class of amounts was taken as the model holds it, not recomputed from the source.

From the first definitions to the first scheduled send took about a week, with test sends to the author alone before any reader saw it.

6. Advice for another team

  1. Put models and reports in version control and publish from there. Compare before and after every publish.
  2. Chain refreshes on completion, not on the clock.
  3. Recompute figures independently, and give headline figures to a checker who has not seen the answer.
  4. Write definitions as a table and agree them on real numbers before building anything.
  5. Hold a report rather than send a doubtful one, and build that test into the report's own flow.
  6. Trigger every alert once on purpose, before the first real send if possible. Then monitor the monitors.
  7. When you depend on someone else's logic, compare the code daily, and verify before adopting.
  8. If you use an AI agent, agree first what data it may read. Give it written rules, an approval for each outward step, and a duty to state what it did not verify. Review its output; do not assume it.
  9. Write the handover document early. It shows you your single points of failure.

7. What remains open

  • The whole service runs on one person's sign-in; a second owner or a service account is not yet in place.
  • One daily check still depends on a desktop computer being awake; the watchdog reports a missed run, but does not replace it.
  • Some failures still send nothing by themselves (a failed model refresh, the source watcher, the reminders); the first of these is covered only by the watchdog and the daily check.
  • Alerts were tested on purpose for the management report only, with steps made to fail, not through a real outage.
  • Two sets of data preparation are kept aligned by a daily check. One shared set would remove the need for it, and has been proposed.