Depreciation anomaly detection

Jesko Rehberg24 Mar 2022

Problem

Accounting teams book asset depreciation every month for each profit and cost center. A wrong or unusual posting changes profit, so it should be caught when the month closes. The centers differ a lot in size, so one global threshold does not work. Some centers also skip months with no postings.

Example from the article: monthly depreciation postings (posting category 40) per profit center from July 2021 to April 2022, where a few centers have a far wider range of amounts than the rest.

Solution in brief

For each profit center, compare the newest monthly amount with the mean and standard deviation of its previous six postings. Flag the row as UCL (upper control limit) when it is above mean + 3 standard deviations, and as LCL (lower control limit) when it is below mean − 3 standard deviations. A second flag works the same way on the differences between the newest amount and each of the last six.

Questions this case answers
  • How to flag an unusual monthly value for each of many segments with different scales, using only that segment's own recent history
  • How to set up an automatic alert on a periodic series with missing periods without training a model
  • How to get an alert when this month's value for a cost center is unusually high or low?
  • How to monitor many segments with one rule when each segment has its own scale?

Tools and methods

  • Statistical process control (control limits at 3 standard deviations) — the alert rule, adapted from quality control charts.
  • pandas — grouping by profit center, sorting by date, building the lagged columns, mean and standard deviation per row.
  • Plotly Express — interactive plots of the amount distribution per profit center, used to inspect the data first.
Continue reading — it's free

Google or a one-time email code. No password.