Skip to content

Automating recurring reports and making their data state traceable

In many businesses, the monthly report is assembled from exports, formulas and one person’s knowledge. Automating it saves that work — but first you have to agree what each figure means and at what point in time it applies.

  • Who it is forControlling, management, team leaders
  • LevelIn depth
  • Reading timeabout 9 minutes
  • Last updated24 October 2026

What you will learn

  • Why copied-together reports produce figures that cannot be verified later
  • How a short definition sheet makes a metric unambiguous
  • Why the cut-off date and the data state are two different things
  • How an automated report is built — from fetching data to archiving

The key point first

A report can build itself and remain verifiable when four things are written down for every metric: its definition, its source, the cut-off date it applies to, and the data state at which it was retrieved. The report carries these details with it. The automation itself — fetching data, calculating, distributing — is then the smaller part of the work; the larger part is agreeing on the definitions.

What goes wrong when figures are copied together

A typical monthly report is put together like this: exports from two or three systems, pulled on different days, pasted into a spreadsheet and linked with formulas that someone set up years ago. It works, and it has weaknesses that only show when questions are asked:

  • The October figure in the November report differs from the one in the October report, and nobody can say why.
  • Two departments quote different revenue for the same month because one counts by invoice date and the other by delivery date.
  • A formula was once adjusted by hand and has since applied to only some of the rows.
  • The report does not happen when the person who knows the order in which to pull the exports is away.

The result is familiar: the meeting argues about the figures instead of what they mean. The data itself is often reliable in the systems; what is missing is a firm agreement on how a figure is derived from it. Why reports so often lead to data being entered twice is described in Avoiding duplicate data entry.

Defining a metric unambiguously

A metric can only be automated once two people working independently would arrive at the same figure from the same data. A short definition sheet for each metric helps:

Definition sheet for a metric
ItemExample “revenue for the month” (hypothetical)
Meaning in one sentenceNet value of invoices issued in the month, less credit notes
Relevant dateInvoice date — not order date or delivery date
Inclusions and exclusionsExcluding internal charges and cancelled invoices
SourceInvoicing in the inventory management system, not the online shop
Owner of the definitionControlling
Valid fromVersion of the definition with a date, in case it changes

The hardest metrics are the ones that seem obvious. “New customer” can mean first created, first ordered, or ordered again for the first time in two years. Each version is defensible, but only one may appear in the report — and it must be named there.

If a definition changes, the figure changes. The report then needs a note stating from when the new definition applies; otherwise a change of method looks like a change in the business.

Cut-off date and data state are two different things

The cut-off date is the business point in time a figure refers to: revenue up to 31 October. The data state is the moment the data was retrieved: 1 November at 6 am. The two almost never coincide, and the difference explains most figures that seem to change “by themselves”.

The reason is late entries. If a cancellation dated 30 October is entered on 5 November, the October figure changes — even though the October report went out long ago. That is not an error; it is reality. It only becomes an error when nobody can trace which figure belonged to which data state.

There are two clean ways of dealing with it. The first: the report is frozen and archived with its data state, and late entries appear in the following report explicitly as a correction to the previous month. The second: every row carries the time it was recorded alongside its business date, so that any earlier state can be reproduced exactly. The example below shows the second approach with a test database held in memory.

PHPPHP 8.3 to 8.5 · tested with PHP 8.4 CLI
<?php
declare(strict_types=1);

// Every row carries two dates: when it happened (business date)
// and when it was entered (recorded_at). Reports filter on both.
$pdo = new PDO('sqlite::memory:');
$pdo->exec('CREATE TABLE cancellations (order_no TEXT, cancelled_on TEXT, recorded_at TEXT)');
$pdo->exec("INSERT INTO cancellations VALUES
    ('A-1', '2026-10-12', '2026-10-12 09:10'),
    ('A-2', '2026-10-30', '2026-11-05 14:02')"); // entered late, back-dated

/** Cancellations up to the cutoff date, as known at the given data state. */
function cancellations(PDO $pdo, string $cutoff, string $dataState): int
{
    $stmt = $pdo->prepare('SELECT COUNT(*) FROM cancellations
        WHERE cancelled_on <= :cutoff AND recorded_at <= :state');
    $stmt->execute(['cutoff' => $cutoff, 'state' => $dataState]);
    return (int) $stmt->fetchColumn();
}

echo 'Report of 1 Nov:  ', cancellations($pdo, '2026-10-31', '2026-11-01 06:00'), PHP_EOL;
echo 'Rerun on 10 Nov:  ', cancellations($pdo, '2026-10-31', '2026-11-10 06:00'), PHP_EOL;
echo 'Reproduce 1 Nov:  ', cancellations($pdo, '2026-10-31', '2026-11-01 06:00'), PHP_EOL;
Output: 1, 2, 1. The report of 1 November counted one cancellation; after the late entry, a fresh query counts two. Using the original data state, the earlier figure can still be reproduced and verified at any time.

Which approach suits you depends on the source systems: not every system stores when a record was created or changed. In that case, freezing the report is the simpler and more reliable solution. A fixed rule for when a reporting month counts as closed — say, on the fifth working day of the following month — helps as well.

How the automated report is produced

  1. Fetch the data from the source systems via an interface or an export, at a fixed time. Which route is suitable is covered in CSV import or API integration.
  2. Check before calculating: have all sources delivered? Is the number of rows within a plausible range? Does a total differ unusually sharply from last month? If a check fails, the report is not sent; instead, a named person is notified.
  3. Calculate according to the definitions: each metric exactly as defined — in one place, not rebuilt in every spreadsheet.
  4. Generate the report with a header stating the cut-off date, data state, sources and the version of the definitions.
  5. Publish or distribute it to a defined group of recipients.
  6. Archive the report and the underlying data for that data state, so that later questions can still be answered.

The second step is the one most often missing. A report that appears even though a data delivery failed shows a wrong figure with every appearance of being right. Better for it to arrive a day late with an explanation. How to notice a run that never happened in the first place is described in What happens when an automation fails?

A hypothetical example

The monthly customer service report

The team leader of a customer service department produces a monthly report with three figures: enquiries received, average handling time and cases still open at month end. To do so, she counts emails in the inbox, cross-checks them against a spreadsheet and extrapolates the handling time from samples. The report takes half a day, and the handling time cannot be verified.

Once enquiries are handled as cases, as described in Turning email enquiries into trackable cases, the data exists. Only the definition is still open. The team leader decides: handling time is the time from receipt to the status “closed”, excluding periods spent waiting for the customer to reply. Open cases are counted as at midnight on the cut-off date.

The report now appears at 7 am on the first working day, with cut-off date and data state in its header. When handling time rises noticeably one month, a click on the figure leads to the list of underlying cases — and shows that a handful of complaints waiting on slow spare-part deliveries is driving the average. The discussion turns to the spare parts, not the figure.

Recipients, permissions and limits

  • Recipients by role, not by name. A report sent to “the heads of department” stays correct when someone changes jobs; a hard-coded address list does not.
  • Publish rather than attach where figures are confidential. A link into an application that requires a login can be controlled; a forwarded attachment cannot.
  • Every figure leads to its data. A metric is verifiable when you can get from it to the records it was derived from — subject to the permissions of the person looking.
  • Questions have an address. Queries about a figure go to whoever owns its definition.

What automation does not take over is the assessment. Whether a trend is good or worrying is judged by people who know the business, so a short comment from those responsible remains part of the report. And if the source data is unreliable, an automated report delivers the same errors — only faster and more regularly. In that case, fix the source first.

Bringing together reports from several systems and providing them with a traceable data state is part of our process automation service.

Common misconceptions

The data is in the system. How a figure is derived from it — which date counts, what is excluded — is usually not, and has to be agreed.

It calculates consistently, but not necessarily correctly. Without a check on the data delivery, it also appears when a source was missing.

Often it is the result of a late entry. It only becomes an error when nobody can establish which figure belonged to which data state.

About the author

Fabian Lücker is managing partner of PHP Schmiede KG in Rheine and has worked in software development since 2007. He is responsible for development and design, and writes here about decisions that come up in real projects.

A report that takes work every month?

Describe which sources your report is built from today and who produces it. We will show you how it can generate itself with a verifiable data state.