D365F&O Accounts Payable Aging report with GL accounts using Power Automate


This will be a short blog post where I will highlight the combination of different methods to solve a business case I came across. Customer wanted to see an accounts payable aging report that will show the offset account (for those not familiar with offset account, it means the expense GL account of those unpaid invoices)

My first thought is I don’t think such a report exists OOB in D365F&O (Please comment below if you seen one). After digging around a little bit, I found the following report in

Accounts Payable>Inquiries and reports>Vendor Reports>Account Statement

2020-02-28 16_47_39-Dashboard -- Finance and Operations

I was familiar with this report, what surprised me was the ability to get the offset account by ticking the offset account button to “Yes”

2020-02-28 16_50_43-Dashboard -- Finance and Operations

I was very happy with the result until I saw the output format of the report. It was your messy standard SSRS report format that comes OOB with the system. Even if you open the report in Excel the format was no where close to being usable to do some research. If you are familiar with D365F&O, you have seen those nasty reports with tons of merged columns and empty space all over the place.

The good news, the report had the data we needed.

2020-02-28 16_55_04-Account statement - Excel


The solution to this issue has different steps:

  1. The first one is to export the report from D365F&O using an excel format, and then have D365F&O email the report directly to your inbox.  The important piece to remember is to use an identifiable email subject that we can use later in Power Automate to find the email.

2020-02-29 17_29_34-Convert_AccountStatement_Transform - Excel

2. Using Power Automate then build a flow to extract the attachment from your inbox and then save it on One drive or a SharePoint folder. The trigger of the flow is to run when an email arrives with the subject used on the email from D365F&O

2020-02-29 17_33_54-Edit your flow _ Power Automate

Then get the attachments from the email

2020-02-29 17_35_03-Edit your flow _ Power Automate

Then save the file. In my case I am using one drive for business. Make sure to give the report a good file name and type .XLSX after the name so it creates an excel file

2020-02-29 17_36_37-Edit your flow _ Power Automate

That’s it for the flow. It is basically just taking the file from your email and then saving it in a specified folder.

3. This is the real trick. In another Excel file, build an automated way to clean up the data, so that every time the report is ran and saved, the data will be cleaned. That’s where Power Query comes into play, it was designed to tackle these repetitive data clean ups. I won’t go into too many details about the Power Query steps, they are fairly simple.

The first one is to read the dirty data from the file saved in your one drive. To get the file path from your excel file, simply look under info and then click under the file name and copy the file path to the clipboard.

2020-02-29 17_41_06-Convert_AccountStatement_Transform - Excel

Then click on the data tab, and then get data from other sources>from Web (Remember that one drive is basically an online file storage)

2020-02-29 17_43_01-Convert_AccountStatement_Transform - Excel

Then paste the file you copied from the account statement file. Remember to erase anything after the ? character. in my case ?web=1

2020-02-29 17_49_38-Account statement - Excel

Then select the file content, and Transform data at the bottom

2020-02-29 17_51_59-Navigator

This will load the raw data into the query editor, and from then perform the steps to clean the report. There are plenty of blogs and videos on how to use the user interface to clean up data using power query. If you want me to write about using Power query in this blog please share comments below.

2020-02-29 17_56_33-VendAccountStatementInt Report - Power Query Editor

After all steps are done, you should be left with a nice clean, tabular format report.

2020-02-29 17_59_34-VendAccountStatementInt Report - Power Query Editor

To finish it off, load the data to your excel file.

The trick here is to change the query settings to refresh the data each time the file is opened. To achieve this, simply right click on the query and then on properties.

2020-02-29 18_03_09-Convert_AccountStatement_Transform - Excel

and then check on “Refresh data when opening file”

2020-02-29 18_04_27-Query Properties

There you have it folks, an OBB way to get clean, usable data from D365 F&O in a more automated way. The goal here is to get the latest clean data every time you run the report from D365F&O automatically.

Old report

2020-02-28 16_55_04-Account statement - Excel


New Report

2020-02-29 18_16_10-Convert_AccountStatement_Transform - Excel

The blog was written to get you to think about the possibilities using, Power Automate, and Power Query to get clean reports from SSRS reports in D365F&O.

Until next time


Juan Sebastian Grijalba, CPA


3 thoughts on “D365F&O Accounts Payable Aging report with GL accounts using Power Automate

  1. HI,

    Thanks for the blog.
    I have a query, If I have paid the invoice with different payment methods then the system is generating the account statement with “Multiple” text in offset account column. How to segregate this?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s