Anomaly Detection in Accounting Records with AI Builder and Power Platform

AI Builder Anomaly Detection in Power Platform allows organizations to improve their financial processes. This is the third case of intelligent automation in financial processes in this article series on using the Power Platform’s AI Builder focuses on anomaly detection in accounting entries and financial transactions. This is a highly valuable solution that enhances the work of professionals in these areas.

Why is anomaly detection in accounting transactions important?

The main advantage of automating this process is the elimination of manual work. Every year, companies of all sizes spend significant resources on validating and correcting accounting transactions.

Another major benefit is the reduced risk of error and fraud. With AI Builder, it’s possible to identify irregular patterns or suspicious transactions in real time, allowing for proactive responses and avoiding significant financial losses.

In addition, this automation helps ensure compliance with regulations. Companies operate in increasingly regulated environments, where adherence to accounting and tax standards is essential. Fast detection of errors and inconsistencies facilitates audits and ensures accurate financial statements, reducing the risk of penalties.

It also increases the efficiency and productivity of finance teams. Instead of spending time reviewing hundreds or thousands of transactions manually, professionals can focus on strategic analysis and informed decision-making. This improves work quality and boosts team motivation by removing repetitive tasks.

Finally, this technology provides clearer insights into a company’s financial health. By identifying unusual patterns or potential discrepancies, organizations can take corrective actions quickly, improving report reliability and overall control of operations.

Rules-based vs. machine learning-based anomaly detection

Anomalies can be detected either using predefined rules or predictive models based on artificial intelligence. Both approaches have their advantages and are used in different contexts.

Rules-based anomaly detection

This method uses fixed rules to determine whether a transaction is considered anomalous. These rules are based on business knowledge and the experience of financial analysts.

Examples of rules commonly used by auditors:

  • Transactions above a certain value require manual approval.
  • Duplicate transactions within a given time frame are flagged.
  • Entries posted to unusual accounts for a given operation are considered suspicious.
  • Invoice-payment mismatches above a certain percentage are flagged for review.

Advantages:

  • Simple to implement and understand.
  • Provides strong control based on regulations and internal policies.
  • Transparent: users know exactly how anomalies are identified.

Disadvantages:

  • Rigid and inflexible — doesn’t adapt to evolving patterns.
  • May produce many false positives and false negatives.
  • Requires constant updates to reflect business changes.

Machine learning-based anomaly detection

This method uses machine learning algorithms to detect anomalies based on historical data patterns. The model learns from past behavior and can flag unexpected activity, even if it doesn’t match any predefined rule.

How it works:

  • The model analyzes large volumes of historical transactions to learn what’s considered normal behavior.
  • Each new transaction is compared against learned patterns.
  • If the transaction significantly deviates from normal behavior, it is flagged as anomalous.

Examples of models:

  • Supervised models: trained on labeled data (normal vs. anomalous). Examples: logistic regression, decision trees.
  • Unsupervised models: work with unlabeled data and identify statistical deviations automatically. Examples: clustering, neural networks, autoencoders.

Advantages:

  • Automatically adapts to new fraud and error patterns.
  • Reduces the need for constant manual rule updates.
  • Detects complex or subtle anomalies that rules can’t catch.
  • Fewer false positives by considering data context.

Disadvantages:

  • Requires large volumes of historical data for training.
  • Can be harder to interpret: the reason behind a flagged anomaly may not always be clear.
  • Needs more computational resources and technical expertise.

Training an anomaly detection model with AI Builder

As mentioned in the previous article in this series, AI Builder requires that training data be stored in a Dataverse table. In this case, we used a table with thousands of accounting entries, with the following structure:

  • Date and time
  • Account
  • Description
  • Debit amount
  • Credit amount
  • Balance

Crucially, since this is a predictive model, the isAnomaly column is used as the label. This binary field indicates whether a transaction is anomalous (1) or not (0). It’s also the hardest column to obtain.

Because this is a binary classification problem with a highly imbalanced dataset (only 2% anomalies), it requires a large volume of data. The model needs exposure to enough examples from both classes for effective training.

During the data collection and preprocessing stage, we also used oversampling techniques to balance the minority class — a topic we’ll explore in another article.

With these technical aspects handled, training the model in AI Builder is straightforward. The interface is user-friendly and entirely no-code.

The first step is selecting the prediction column (isAnomaly), followed by selecting the relevant input columns — as shown above. Optional filters can also be applied if you want to exclude or reserve part of the data for testing.

To train the model, simply click “Train” — it couldn’t be easier:

AI Builder will try to identify predictive patterns to detect anomalies. In our training dataset, we got the following results:

The model was rated “B” with an R² score of 81%. This is a solid result given the complexity of training models on imbalanced datasets. The platform also provides explanations of the results. In our case, transaction date and amount were the most important variables, followed by hotel-related expenses.

Detailed metrics can be exported as a JSON file. In our case:

{
  "metrics": [
    { "name": "Mean Absolute Percentage Error", "value": 13.60 },
    { "name": "Mean Absolute Error", "value": 0.1177 },
    { "name": "Normalized RMSE", "value": 0.2159 },
    { "name": "R2 Score", "value": 0.8121 },
    { "name": "Performance Score", "value": 0.8121 },
    { "name": "Root Mean Squared Error", "value": 0.2159 },
    { "name": "Spearman", "value": 0.8390 }
  ]
}

Testing the model on unseen data

Before deploying, we must test the model. While AI Builder does internal train/test splitting, we also tested the model with new, unseen data. The confusion matrix below shows performance:

Green cells are correct predictions; orange cells indicate errors.

Deploying the model

The model can be run on a regular schedule (e.g. daily) and update results in Dataverse, or it can be integrated into an intelligent automation flow using Power Automate.

For example, every time a new transaction is recorded, we can call the model to get a prediction. If it’s an anomaly, an alert can be triggered — such as an automated email notifying the team of a transaction that requires review.

Share your love
Nuno Nogueira
Nuno Nogueira
Articles: 33

Leave a Reply

Your email address will not be published. Required fields are marked *