Send Power BI Report in Email using Power Automate

This is final part (part 6) of the series “Send Power BI Report in Email using Power Automate“. In this post, we will create a flow that will get triggered when a file is created or modified at the SharePoint location. We pick up the file (power bi report) and embed in the email.

Pre-requisites

  1. Install Power BI Desktop
  2. Create a Simple Power Bi Report | Connect Power BI to SharePoint File
  3. Publish Power BI Report
  4. Send Power BI Report to Email | Subscribe to Emails
  5. Save my email attachments to a SharePoint Location using Power Automate

Follow the previous parts to get an overview of this blog series.


Create the flow

In the last part, we had created a power automate flow that will save the power bi report attachment at the SharePoint location. In this part, we will create another flow which will get triggered when a new file is added or modified at the SharePoint location.

To do that, we will again use a readymade template. Login to flow.microsoft.com and search for below template.

Give permissions by signing in to your account.


Below is the readymade flow created for you. Delete the trigger (Step 1) and replace it with “When a file is created or modified (properties only)“.

Before
After

Select the Site address, Library Name, and Folder. Select the same folder which we created to save the attachments.

Create a new step Compose before Get my Profile. Add the following expression in the input. This is required because we have to make the month year dynamic which will be part of the Email Subject.

formatDateTime(utcNow(),'MMM-yy')

Compose the email in html for better control. You can compose the email without html as well but to give the image link, you will have to switch to html.

<p>Hi All,<br>
<br>
Please find the updated financial report. Following observations are made -<br>
1. Observation a<br>
2. Observation b<br>
3. Observation c<br>
<br>
<br>
<img src="@{items('Apply_to_each')?['{Thumbnail}']?['Large']}" alt="power bi report">
<br>
<br>
Thanks,<br>
JD Bots</p>

Select Thumbnail Large from dynamic content and put it in the image source. You can also customize the image size by giving height and width attributes in img tag.


You will notice that, the moment you add the Thumbnail Large, the Send an email step moves inside Apply to Each step. This is completely fine.

Give the Compose output in the Subject to set the dynamic month year. Below is the final workflow.


Here is the sample email sent by the flow. The image size is huge which gives a clear view of the report. If you have single visual in the page then you will have more details going into the email.

This creates the complete automated end to end solution for sending power bi report in email without using any third party tools. Schedule the Refresh of Power BI Report and we are good to go.

Thank you All!!! Hope you find this useful.

If you liked our content and it was helpful, you can buy us a coffee or a pizza. Thank you so much.


Up ↑

%d bloggers like this: