top of page
  • Writer's pictureVahid

How to add a button to the Power BI report for sending a PDF of the report to the User Email

Updated: Nov 23, 2022





It is prevalent that users want to have a PDF version of a report published on the Power BI service, and I think It'd be great if a button on a report enables users to receive the PDF of the report through their emails.

This article will explain how to use the "Power Automate for Power BI" visual to add a button for sending a PDF of the report to the user's email who clicks on that button.


Step 1: Add a Button

The Power Automate visual for the Power BI desktop has been added to the default visuals pane since July 2021. If you are using the updated version, you need to click on the Power Automate for Power BI on the Visualizations pane; otherwise, you need to download that from AppSource.


Step 2: Create a measure and add that to the Power Automate Visual

Create a measure with the following code to find the user email address


The USERPRINCIPALNAME () will return the name of the user as their email address, aka user@domain.com.




Step 3: Setup a flow

Select Edit in the more option (...) menu of the Power Automate Visual and follow the instruction to create a flow:


  • Click on the New button and select Instant cloud flow.

  • Click on New Step

  • In Choose an operation, search for Power BI and select Export to File for Power BI Reports.

  • In Export to File for Power BI Reports, select a Workspace and Report from the dropdowns.

  • In the Export Format, select PDF.

  • Optionally, if you want to send the report based on row-level security (RLS), you need to add the following details (The next Image is from Microsoft Doc):

  • Optionally, indicate specific pages to export in the Pages pageName -1 field. Note, the page name parameter is different from the display page name. You can find the page name by navigating to the page in the Power BI service, and copying the last portion of the URL, as shown in the example below. Example: https://app.powerbi.com/groups/workspaceGuid/reports/reportGuid/xxxxxxxxxx

  • Optionally, indicate a specific bookmark to display in the Bookmark Name field. You can find the bookmark name in the report URL after bookmarkGuid=, as shown in the example below. Note, only report bookmarks are supported, not personal bookmarks. Example: https://app.powerbi.com/groups/workspaceGuid/reports/reportGuid/ReportSection?bookmarkGuid=xxxxxxxxxx

  • Select Next Step

  • In Choose an operation, search for Send Email and select Send an email notification (V3).

  • Select Add dynamic content in the To section.

  • Choose Power BI data User under the Power BI Button clicked section.



  • Complete the Subject and Body section

  • Click on the Show Advanced Options to configure the attachment, CC, and BCC.



  • In the Advanced Options, you can add emails in the CC and BCC sections.

  • There are 2 sections for attachment:

    1. Attachment: In this section, click on the Add dynamic content and select File Content under the Export To File for Power BI Reports

    2. Attachment File Name: In this section, add a name for the attached file with the File Extention (*.pdf); I used Test.pdf



The flow is completed now, click on the Save, then Save and Apply and return to the report. There is a new blue button on the report that will run the flow if you click on it.

Publish the report and then test the button on the Power BI Service.

The email will be like this:




Note:

  • The email will be sent from microsoft@powerapps.com.

  • The PDF will contain all report's pages (you can change the Export to File for Power BI Reports configuration and select specific pages or visuals)

Limitation:

  1. The report MUST be in the workspace that is backed by a reserved capacity; This capacity can be any of the A1/EM1 - A6/P3 SKUs. (not Premium per User capacity)

  2. Send an email notification (V3) can only send 100 emails every 24 hours. (If you want to send the email from your email address or need more than 100 emails per day, you can use send an email notification (v2) that can send 900 emails every 60 seconds)





1 comment

Recent Posts

See All
bottom of page