Icon

Anomaly_​Detection_​Benford

About

This workflow applies Benford's Law First-Digit Analysis to an anonymized General Ledger (GL) extracted from a real accounting environment. The dataset is available on Kaggle:
🔗 Anonymized General Ledger Dataset

The focus is practical, not theoretical — specifically, analyzing multiple account code sub-groups independently, which is what real audit work demands. KNIME's Group Loop drives the per-segment iteration automatically.

Detection Logic

A two-level flagging approach is applied at each Account Code segment:

  • Dataset Level — MAD (Mean Absolute Deviation) classifies each segment against Nigrini's conformity thresholds

  • Digit Level — Gate 1 (Absolute Deviation) × Gate 2 (Z-Score); a digit is flagged only when both gates fire, keeping findings defensible

Notable Techniques

  • Empty Table Switch — handles zero-anomaly iterations cleanly

  • Email Connector with Attachment — delivers the anomaly report automatically, making this usable in a recurring audit cycle

General Ledger Anomaly Detection Using Benford's Law First-Digit Analysis

Group looping started
by Account Code
Looping Ended
MAD Anomaly Flag
By Account Code Level
Account Code * Digit Level Anomaly Flag
Gate 1 + Gate 2
Anomaly Email Alert with Attached

Save to download folder (for temp) in Excel Writer node.

Configure in Email Connector using your mail server, and log in credentials.

Variable to Table Row node and Email Sender (Labs) (Attached) will use you temp file location from Excel Writer node.

Observed CountObserved %
Column Renamer
by Account Code
Group Loop Start
Benford's Expected %
Table Creator
Loop End
Gate 1+2Flag
Rule Engine
Joiner
Row Splitter
Joiner
MAD
GroupBy
Absolute Deviation
Math Formula
MAD FlagAccount Code Level
Rule Engine
Empty Table Switch
Concatenate
Cross Joiner
Path Connect
Variable to Table Row
GL
Table Creator
Email Connector (Labs)
Alert Email Sendwith Attachment
Email Sender (Labs)
Gate 1Flag
Rule Engine
Table to Excel Export
Excel Writer
Gate 2Z-Score
Expression
First Digit
Expression
Gate 2Flag
Rule Engine
Count by Digit% by Digit
GroupBy
DerivingAmount Column
Math Formula
GroupBy
Cross Joiner

Nodes

Extensions

Links