Using AI for Data Correction

Using AI for Data Correction

How do you usually use Generative AI? That’s a question I get asked quite often. Most of the time, my answer is something like this: “I use it to summarize texts. I also draft ideas together with the AI, and it helps me write content more efficiently.” But this is just one piece of the puzzle. In automation scenarios within the Power Platform, I also utilize AI for data correction. Today, I will explain how this process works.

In detail, some weeks ago I faced a data correction problem during preparation for the Baltic Summit 2025 at Gdansk, Poland. I have already prepared my demo application – my Expenses Manager – a Dataverse solution. I uploaded my receipts to have some data that I can show to my audience. Furthermore, I added a chart to my model-driven app, but what was this:

I thought: Oh no, my data is not grouped as expected. What did I wrong? Why do I see so many merchants?

Let me tell you why…

My Problem

From my data extraction process based on Azure AI Content Understanding I get raw JSON data from my invoices. This data has already the correct data types. So good so far. But when I have a closer look at the extracted merchant information, I see this:

Yes, you see correctly extracted information from my receipts and invoices. But you see also, this doesn’t help me to group these records by the field Merchant. This is because “Deutsche Lufthansa AG” and “DEUTSCHE LUFTHANSA AG” are different. The same situation applies as well to “DB Fernferkehr AG” and “DB”. The merchants are equal for me as human, but not for my model-driven app.

Therefore, I must correct this data manually or I’m including AI into this process…

Data Correction with AI

I’m including AI! First, I must prepare my data correction process. This is because the AI should somehow know which merchants are correct. Therefore, I set up a new Dataverse table Merchant Synonyms in my Expenses Manager.

Here I’m adding the expected names of my known merchants:

As next step I must utilize the AI. The simplest trick in Power Platform is to create a new Prompt. Unfortunately, I can’t do this directly from my solution, therefore I’m navigating to AI Hub and click on Prompts:

There I start building my own prompt:

In my new Prompt I’ll keep the proposed model GPT-4.1 mini. In detail, GPT-4.1 mini should be sufficient to solve this task.

I start entering my instruction and add my first Input parameter of type Text:

I call this parameter Merchant and provide Sample data:

Next, I continue with writing my instruction and add another Input Parameter. Here I’m selecting Knowledge from Dataverse:

Furthermore, I’m selecting my Dataverse table and the column Name:

I do not need to add a filter for the table. This is because my Merchant Synonyms are curated and its values are unique:

Afterwards, I’m changing the output format to JSON and provide here an example of my expected outcome:

Finally, I’m running some tests and reviewing the results:

As you can see, my Prompt did correctly return “Deutsche Lufthansa” and not “DEUTSCHE LUFTHANSA AG” from input parameter. Now I can save my new prompt.

Include AI into my Automation Process

Currently, my Prompt “Expenses Management | Correct Merchant Name” is stored outside of my Dataverse solution. Therefore, I’m adding my Prompt to my solution by clicking on Add existing and selecting AI Model in solution designer:

Next, I can select here my Prompt:

Now in my Power Automate Flow Analyze Document I must add the action Run a prompt from AI Builder to call my prompt:

I do this directly after my action Parse Result Fields. Moreover, I’m configuring my action parameter Merchant with the extracted field MerchantName:

Finally, I’m using the result from my prompt as parameter in the coalesce and assign the result to my Dataverse action parameter Merchant:

The overall process is now this:

You see, my Power Automate Flow is utilizing my content understanding analyzer Extract Document Data. Here the information from my documents is extracted as JSON. Afterwards, my data is corrected by AI within my prompt Correct Merchant Name. In detail, the prompt is using the data of table Merchant Synonyms. Finally, the resulting records are now this:

Yes, the merchants are now corrected based on my table Merchant Synonyms and my data can be grouped in my app:

Summary

As you see, I faced a small problem in my model-driven app, which was caused by data that could not be grouped together. The data was correctly imported, but, on the other hand, slightly different. In conclusion, this prevented the grouping in my model-driven app. Therefore, I decided to utilize AI for the data correction process of my merchant names.

First, I created a new Dataverse table where I stored expected information as Merchant Synonyms. In addition, I created a new prompt in AI Hub. This prompt uses its input parameter together with the content of the table Merchant Synonyms to correct the given merchant’s name. Furthermore, the created prompt returns the corrected information as JSON. Next, I integrated that prompt into my existing Power Automate flow to automatically correct and use the merchant’s name. As a result, my data extraction process now imports data that can be grouped in my model-driven app.

You see, how easily AI can be utilized. Here in this example, I gave the AI a very simple and specific task: Find the correct value for the input based on the given examples. Utilizing AI resulted in enhanced data organization and efficiency for my app. Additionally, this approach demonstrates scalability and extensibility, allowing for the handling of more data and merchant names in the future. Finally, automating this process saves time and reduces manual errors, showcasing the power of AI in streamlining workflows.

Share

Leave a Reply