image.png

🗒️Table of Contents

Overview

I have previously written here and here about ways to make Power BI dashboards more interactive by embedding canvas apps. In this post, I’ll walk through how to add a feature that lets users quickly add notes to a selected record—updates that can appear in real time if your dashboard uses DirectQuery. For a deeper look at the Power Apps visual for Power BI, check out the first linked post. But if you're ready to build a streamlined, in-dashboard notes feature, this guide will get you up and running in just a few steps.

Setting Up the Power BI Report

In my example, I have two Dataverse tables:

There is a one-to-many relationship between the Test Help Desk Tracker table and the Test Help Desk Notes table. That is, one request can be associated with multiple notes.

image.png

This note-taking method can work with either Import or DirectQuery mode, but if you want the notes to appear in real time (as I do in this scenario), select DirectQuery when connecting to your tables. In terms of visuals, for this you will need a table or other visual that allows you to select an individual record to take a note about. I added a table of data from the Test Help Desk Tracker table to show the request ID, title, status, category, priority, received and due dates, and assigned technician. To display any related notes when you hover over a record, I created a tooltip page:

  1. Add a new page and in the page’s Page information, toggle on Allow use as tooltip. This will resize the page so you have a smaller space to work with.

  2. In this smaller space, create a table visual and drag 3 fields from the Test Help Desk notes table: Note (text field), Created By and Created On (metadata fields automatically present in Dataverse tables). Change the format of the Created On field to short date.

  3. Select the main table visual (not the one you just created on the tooltip page but the main table of requests). Under General > Tooltips turn tooltips on. Under Options, set the type to Report page and set the page to the page you just created. Now when you hover over the table, you will see any associated notes.

    image.png

Once your report is created with all other visualizations in Power BI Desktop, publish this file without the embedded app to Power BI Service. We will be adding and configuring the app from Power BI Service for the most seamless app building experience.

Setting Up the Canvas App

  1. From your published report in Power BI Service, click Edit.

  2. Insert the Power Apps for Power BI visual and resize/reposition as needed.

  3. Add any fields you want to include in your app into the PowerApps Data well. For this example, I only need to pass the Request ID field from the Test Help Desk Tracker table so that the app knows which record we’re working on. We don’t need to pass anything from the Notes table because we’re just creating new records in the Notes table from the app - there’s no communication from Power BI to the app regarding Notes. Power BI, via DirectQuery mode, will grab the latest Notes records from the Dataverse table that we will update from the app.

  4. In the Power Apps visual, click Create new. This will open Power Apps studio in your browser.

  5. Set up the basic design of your app:

    1. Insert a text box to indicate what record the user is submitting a note for:
    "Creating note for " & First([@PowerBIIntegration].Data).'Request ID'
    

    NOTE: To refer to the selected record being passed from Power BI, you use the First( ) function because the data is passed from Power BI in a table format and this returns the first (and only) record. [@PowerBIIntegration].Data gets you the object being returned from Power BI, and adding a period after that will display all the fields you can access. If a field isn’t appearing for you here, make sure it is added to the Power Apps visualization data well (see step 3).

  6. Add a text input control where users can type their notes.

  7. Add a button to submit the note.

    1. On the left pane, select the Data icon and add both the Dataverse tables as data sources the app can access.

      image.png

    2. Update the button’s Onselect property to create the new record in the Notes table, show an in-app success banner notification, refresh the integration with Power BI, and reset the text input control to blank.

    // create the new note record
    Patch(
        'Test Help Desk Notes',
        Defaults('Test Help Desk Notes'),
        {
            Note: inp_note.Text,
            'Ticket Lookup': LookUp(  // this section associates the note with the proper ticket
                'Test Help Desk Trackers',
                'Request ID' = First([@PowerBIIntegration].Data).'Request ID'
            )
        }
    );
    
    // show in app success banner
    Notify(
        "Your note has been submitted",
        NotificationType.Success,
        5000
    );
    
    //refresh the integration
    PowerBIIntegration.Refresh();
    
    //reset the note text control to blank
    Reset(inp_note);
    
    
    1. For a better user experience, I like to add a text control that overlays the screen but is only visible if a user hasn’t selected a record in Power BI. This app works on one record at a time, so when the user first opens the screen I don’t want them to be able to access the scheduling functionality. Insert a text control, give it a solid color background, and make sure it is at the top of your tree view so it blocks other controls when it is visible. Set its visibility to:
    CountRows(PowerBIIntegration.Data) <> 1
    

    We use this construction rather than something like IsBlank( ) or IsEmpty( ) because when the canvas app first loads up in Power BI, it interprets all records as being selected (rather than none). So if I had 100 total records in my table and I ran the above Countrows( ) function, when my dashboard first loaded up the app would show 100 rows being counted. Therefore, we want to show the text box when no selection has been made; that is, when Countrows( ) is returning anything other than 1.

Access, Permissions, and Other Notes

Always make sure you remember to save and publish your app in order for your changes to be visible in the embedded app in Power BI.

For someone to use this functionality, in addition to the appropriate Power BI permissions to view the dashboard, you will also need to share the canvas app with them. From the canvas app editor, click the Share icon in the top right and add users or groups as appropriate.