Creating an Auditing Tool
Power Query for audit work
Section titled “Power Query for audit work”A common audit task is to check a list of data received from outside, such as a customer’s payment details, against the business’s own records. Power Query handles this well, because the checks are joins between two tables, and once they are built they can be run again on next month’s files with a refresh.
This page builds a small workbook that does the whole check automatically.
The scenario: a remittance advice
Section titled “The scenario: a remittance advice”A wholesaler sells on credit to many customers, and each customer receives several invoices a month. At the end of the month the wholesaler sends each customer a statement of the invoices due. The customer pays a batch of invoices with a single payment, and sends a remittance advice that lists the invoices the payment covers.
The task is to check the remittance against the accounts receivable (AR) system and find:
- invoices that have not been paid
- invoices that have been paid but were not on this month’s statement, such as a late payment of last month’s invoice
- invoices paid at a different amount from the amount invoiced
There are two source files. The first is the customer’s remittance:

It lists the invoices the customer has actually paid and the amount paid on each. Its total agrees with the payment received, but not with the statement that was sent.
The second is an extract from the AR system:

The two files have much the same layout, and the job is to reconcile the remittance against the AR records.
1. Connect to both files from a new workbook
Section titled “1. Connect to both files from a new workbook”- In a new workbook, choose Get Data, then From File, then From Workbook, and pick the remittance file.

- In the Navigator, select the sheet and choose Transform Data.

- The data needs no further work, so just rename the query to Remittance.

- Choose Close & Load To, and then Only Create Connection.

The query now appears in the Queries & Connections pane as a connection only, which means it holds the data without writing it to a worksheet:

- Do the same for the AR extract, and give that query a clear name too. Both queries are then listed:

- Grouping the queries makes the workbook easier to follow later. Right-click a query and choose Move To Group, then New Group.

- Name the group Connections.

- Move both queries into it, so that the pane looks like this:

The next step is to build three report queries:
- invoices not paid
- invoices paid that were not on the statement
- invoices paid with a payment variance
Report 1. Invoices not paid
Section titled “Report 1. Invoices not paid”- On the Data tab, choose Get Data, then Combine Queries, then Merge.

- The AR listing is the book of record, so choose it as the first table.
- Choose Remittance as the second table.
- Click the Invoice Number column in the first table, and then the Invoice Number column in the second.
- Leave the join kind as Left Outer, which keeps every AR invoice whether or not it was paid. The dialog reports that 2,160 of the 2,206 AR invoices have a matching payment.

- Click the expand button on the new column, untick everything except Payment Amount, untick Use original column name as prefix, and choose OK.

The new column is called Payment Amount.1. Wherever it holds null, no payment in the remittance matched that AR invoice, so the invoice has not been paid.

- Filter Payment Amount.1 to keep only the nulls.

- The column has done its job, so right-click its header and choose Remove.

- Name the query, then choose Close & Load To, and this time load it to a table on a new worksheet.

- Move the query into a new group called Reports, in the same way as before.

Report 2. Invoices paid but not on the statement
Section titled “Report 2. Invoices paid but not on the statement”- Start another merge in the same way, but with the tables the other way round, so that Remittance is first and the AR listing second.

The rest follows the first report, and the result lists every payment for an invoice that was not on the statement.
One difference may appear when filtering for nulls. The filter list shows only the values Power Query has read so far, and if it says List may be incomplete, null may be missing from it. Choose Load more to read the rest, and then select null as before.

- Finish the query as in the first report: remove the column, name the query, load it to a table, and move it to the Reports group.
Report 3. Invoices paid with a payment variance
Section titled “Report 3. Invoices paid with a payment variance”The last report finds the invoices that were paid at a different amount from the amount invoiced, whether short or over. It starts from a copy of the first report.
- Right-click the first report and choose Duplicate.

- Rename the copy, and delete its last two steps by clicking the cross beside each in Applied Steps, which leaves Source and Expanded Remittance.

- On the Add Column tab, choose Custom Column, and subtract the amount paid from the amount invoiced:
![The Custom Column dialog with the formula [Payment Amount]-[Payment Amount.1]](/_astro/auditing-tool-24.CqM86seu_Z2vdzjM.webp)
- Filter the new column, unticking 0 and null. The rows that remain are the invoices with a variance.

- Rename the columns so that the report reads clearly.

The tool is complete. To run it on another month’s files, point the two connection queries at the new files and choose Refresh All.
This example follows Matt Allington’s post Power Query as an Audit Tool on Excelerator BI.