Date compression and archiving: shrinking years of retail ledger entries without losing the plot
A retail database grows in a way an office business's never does. Every sale at every till is transactions, payment entries, and ledger postings, every day, at every store. Over years, that volume has a cost: accumulated data can slow things down, reports take longer, records lock more often, and large amounts of data can lead to increased storage costs, which in Business Central online can mean real money. Microsoft's answer is date compression: combine several old entries into one new entry, keep the totals, delete the originals. It is a powerful tool with sharp edges. This guide gives a retailer the order of operations: decide what detail is worth keeping, archive before you compress, and treat the job as irreversible from the first filter you set.
What date compression actually does to an entry
Compression, based on dates, combines several old entries into one new entry. Take vendor ledger entries: after compression there can be only one credit and one debit entry per account per month, where the amount in the new entry is the sum of all the compressed entries, and the date assigned is the starting date of the compressed period, the first day of the month, if you compress by month. The net change for each account in the period survives; the individual entries do not. On the General Ledger Entries page, the new entries carry the Description Date Compressed, so they are identifiable afterwards, and the results of a run are visible on the Date Compr. Registers page.
Eligibility is strict, and all three conditions must hold: entries are from closed fiscal years, the Open field is set to No, and they are at least five years old. Compressing data less than five years old is not a setting you can flip, it requires your Microsoft partner, using the OnSetMinimumNumberOfYearsToKeep event in the Date Compression codeunit. For most retailers that five-year floor is a sensible default posture anyway: recent history stays in full detail, and compression is a decision about genuinely old years.
Decide per entry type: what detail is worth keeping
The compressible types include finance entries. G/L entries, VAT entries, bank account ledger entries, G/L budget entries, customer ledger entries and vendor ledger entries, plus warehouse entries, resource entries, item budget entries, and fixed asset ledger, maintenance and insurance entries. The number of entries a compression produces depends on the filters you set, which fields are combined, and the period length you choose; there is always at least one entry. The lever that decides how much reporting survives is Retain Field Contents: when defining the criteria, you can keep the contents of certain fields, and some are always retained, including Posting Date, Vendor No. Document Type, Currency Code, Posting Group and the Amount fields. A practical decision table for a retailer:
| Entry type | Retail volume | Suggested posture |
|---|---|---|
| G/L entries | Highest, every statement posting lands here | Compress by month for years past the floor; retain dimensions and document fields you still report on |
| Bank account ledger entries | High, daily deposits per store | Compress with the G/L; remember compressed bank entries can no longer be reversed (below) |
| Customer and vendor ledger entries | Moderate, vendor invoices are few; POS-driven customer entries can be many | Compress by month; the per-account net change survives, which is what old-year analysis needs |
| VAT entries | High, but sensitive | Compress only with your accountant's agreement, tax history has its own retention logic, outside this guide's scope |
| Warehouse and item budget entries | Varies | Often the safest early candidates: operational detail ages fastest |
| Change log and other logs | Grows quietly | Not date compression, use retention policies, which delete log entries after the period you specify |
One dependency hides in the fine print: before you can run date compression, your analysis views must be current. Update them first, or the compression waits.
Archive before you compress: the Data Archive extension
Compression deletes the originals, that is the point, and the risk. The Data Archive extension exists for exactly that discomfort: it provides a basic framework for archiving and backing up data as part of date compression, so rather than deleting the detailed entries outright when they are consolidated into a single entry, you can archive the data for later use. For a retailer, the decision rule is simple: if anyone, an auditor, a franchise review, a dispute with a landlord over an old year's sales, might ever ask for the detail behind a year you are about to compress, archive that year first. Archiving is cheap insurance taken before an irreversible step; afterwards, the option no longer exists.
Pre-flight checklist before anyone runs the job
- Back up the database. Microsoft's warning is blunt: date compression deletes entries, so always make a backup copy of the database before running the batch job.
- Prove eligibility. Candidate data is from closed fiscal years, Open = No, and at least five years old, or a partner has deliberately set a lower threshold and everyone knows it.
- Decide the archive question per data type (above), and run the Data Archive step for anything with a plausible future question attached.
- Update analysis views so the job is allowed to run.
- Set filters deliberately and screenshot them. The result depends on your filters, fields and period length; the register will show what ran, but the intent should be recorded before it runs. The same discipline applies to the deletion batch jobs on the Data Administration page: review filters before running, because some jobs don't ask for confirmation and blank filters can include all eligible records, and deleted data can't be recovered.
- Schedule it off-hours and tell finance it is happening: entry number gaps on the G/L are a known side effect (below), not a mystery to discover later.
Running a compression safely
- Search for Data Administration.
- Choose the guided path, Data Administration Guide, to set up compression for one or more data types, or the direct path: Data Compression > Compress Entries, then select the data to compress.
- Set the date range to a single closed fiscal year for the first run. Prove the process on one year and one data type before batching the backlog.
- Set Retain Field Contents to the fields your reporting still uses for that year, and the period length (month is the usual balance of size saved versus detail kept).
- Run it, then go straight to the verification step below before running anything else.
After the run: registers, gaps and what no longer reverses
Verify on the Date Compr. Registers page, which shows the result of the batch job, and spot-check the compressed period: the new G/L entries show Description Date Compressed, and the period's net change per account should equal the pre-run balance, compression changes detail, never totals. Expect gaps in the entry number series on the General Ledger Entries page: the posting process creates those gaps deliberately, and the number range assigned to the ledger entries can be viewed on the G/L Register page in the From Entry No. and To Entry No. fields. And record the hard consequence in your close documentation: after date compression, you can't reverse vendor or bank ledger entries for any transactions affected by the compression. An old-year correction after compression is a new journal, not an unposting.
What success looks like
- A backup exists from before the run, and archived copies cover every year whose detail might still be questioned.
- The Date Compr. Registers entry matches the intended year, data type, filters and period length, and the compressed period's totals tie to the pre-run balances.
- Nobody discovers the entry-number gaps or the no-reversal rule by accident; both are written into the close notes.
- Logs and archived documents are handled by retention policies on their own schedule, not by the compression job.
FAQ
How old must entries be before date compression?
At least five years old, from closed fiscal years, with Open set to No. Compressing
younger data requires a Microsoft partner to change the threshold in the Date
Compression codeunit.
Does date compression delete data permanently?
It deletes the original entries and replaces them with combined entries, which is why
a backup beforehand is mandatory in practice, and why the Data Archive extension
exists for data you want to keep in detail.
Can you reverse an entry after date compression?
No, vendor and bank ledger entries affected by compression can't be reversed
afterwards. Corrections are made with new entries instead.