Thoughts, Dynamics 365, random business ideas, etc.

How to add comments to financial statements in Power BI

Screenshot showing a power BI report with an embedded Power App to receive comments about financial transactions

I wrote a post about how to use Power Automate and Power BI together. It’s pretty cool, but I also want to be able to add some free text to the Power Automate directly from Power BI. One approach would be to use Teams and send myself a responsive card with a request for comments, send that on to some other user, and then, upon completion, finish the Power Automate flow. Here’s a different approach.

Scenario

You’re reviewing GL detail for the month. One line item catches your eye – a big Azure subscription cost. Rather than emailing the IT manager directly and needing to copy over the journal number and whatever, you want to select the line directly in Power BI, ask a question, and then send the note to the owner of that department.

How we’ll accomplish this

There are three things we’re going to build:

  1. A Power BI report showing our expense data
  2. A canvas-based Power App that will be embedded into Power BI to receive our comments
  3. A Power Automate flow that will send our comment to the appropriate person

A user will login to Power BI to review their data. When they have a particular row or journal, they’ll select it. Selecting the data will provide it as context to the embedded Power App. They’ll enter their comment in the Power App, click the button inside the Power App, and then Power BI record AND the comment will be sent to Power Automate. The Power Automate flow will then send a Teams message telling someone there’s a comment.

Building the Power BI report

For this demo’s purpose, I just manually created a dataset in Excel.

Obviously, this data will probably be somewhere else. In other posts, I showed how to make a Financial Statement in Power BI – you could use that.

The important thing here is to make sure that whatever information you need to send across to the Teams message is included in this data set somewhere.

Building the Power App

As you saw in the original screenshot, the Power App is pretty basic. The trick, though, is creating it from Power BI.

When you create a Power App from Power BI, a Power BI connection is automatically added. After the app visual is added, you need to add the fields to the visual – these fields reflect the data that’s going to be passed to the Power App.

As you can see in the above screenshot, I’m going to pass the “Submitted by” and “Journal ID” through to my Power App.

By default, the Power App will have a gallery whose data is linked to the Power BI record set. I just hide this.

In the Power App I built for this demo, I added a text label that says “Comments” and a multiline text input to receive the comments.

I added a Power Automate flow to the Power App. I created it directly from the Power App, so it was all linked together properly.

I also created a button. The button’s OnSelect code is set as:

Set(
    jsonValue,
    JSON(
        [@PowerBIIntegration].Data,
        JSONFormat.Compact
    )
);

IfError(
    NotifyauserinTeams.Run(jsonValue, txt_Comments.Text),
    Notify("There was an error sending your comment.", NotificationType.Error),
    Notify("Your comment has been sent.", NotificationType.Success)
);

This code takes the Data passed from Power BI, turns it into a JSON record, and then passes that AND the comments over to Power Automate.

There’s also a little piece in here that, when it submits successfully, sends a note to the user.

Building the Power Automate

The Power Automate also isn’t particularly complex. It takes the input from Power Apps, parses the JSON, loops through each record, and sends a notification to the appropriate user.

Thoughts on how to make this better

  1. Use Power Automate to get the recipient of the comment from the ownership of the GL account or Department
  2. Store the comments in SharePoint
  3. Send the comments to the user via a responsive card and have the response tracked in the SharePoint list

Conclusion

The data above is pretty chintzy, but I didn’t want to spend a ton of time building a dataset for this blog post. I built something similar for a customer of Tapestries with more fields in the Power App and a better use case, but I think this simple exercise proves a point.

I’ve always wanted a way to provide some feedback on Power BI data, and this way seems to work perfectly fine.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Comments