Fix: Quarterly Summary running totals now correctly scoped by business type
Fix: Quarterly Summary running totals now correctly scoped by business type
Released in v1.0.426
What was the problem?
For organisations registered with both a self-employment (SE) business and a property business under the same MTD account, the running totals shown on the Quarterly Summaries dashboard were wrong.
The query that calculates per-quarter transaction counts and running totals was fetching all transactions belonging to the organisation, without any filter for which business type was being viewed. The result:
| Tab being viewed | What running totals included (incorrectly) |
|---|---|
| SE business | Property rental income and SE trading income |
| Property business | SE trading income and property rental income |
This was a high-severity data accuracy issue. Inflated figures could cause a user to believe they had higher income or expenses than they actually did for a given business before submitting a quarterly update to HMRC.
What changed?
The listBusiness query in the quarterly summary router now applies a business-type filter to the transaction count and running total calculation.
The filter is derived from the typeOfBusiness field on the business record:
- Self-employment businesses — only transactions with an
hmrcCategoryprefixedse_(e.g.se_turnover,se_costOfGoods) are included, along with any uncategorised transactions that are not linked to a property. - Property businesses — only transactions with an
hmrcCategorythat is not prefixedse_are included, along with uncategorised transactions.
This ensures that the running totals and transaction counts shown for each business tab reflect only that business's transactions, regardless of what other businesses exist in the same organisation.
Who is affected?
This fix applies to any organisation that has both a property business and a self-employment business registered on the platform. Organisations with only one business type were not affected and will see no change in behaviour.
What do I need to do?
Nothing. The fix is applied server-side. Refresh the Quarterly Summaries dashboard to see corrected running totals. No data has been altered — only the query that calculates the displayed figures has changed.
Technical detail
The core change is a categoryFilter SQL predicate added to the txCounts query inside listBusiness in src/lib/routers/quarterly-summary.ts. All other logic — buildQuarterRunningTotals, stored summary mapping, and the shape of data returned to the client — is unchanged.
-- SE business filter
(
hmrcCategory LIKE 'se_%'
OR (
(hmrcCategory IS NULL OR hmrcCategory = 'unused')
AND propertyId IS NULL
)
)
-- Property business filter
(
hmrcCategory NOT LIKE 'se_%'
OR hmrcCategory IS NULL
)