I hear this ask quite a bit these days – I want to be able to create e-mail subscriptions with PDF (or other file format) attachments of my full Power BI report or dashboard. Well, you can actually do this already, thanks to Microsoft Flow and Paginated Reports in Power BI Premium or SQL Server Reporting Services/Power BI Report Server if you chose to do so.
If you read my blog post last week, I showed you how to use Flow to take your e-mail attachments and save them to a OneDrive for Business folder. While I did it for PDF’s in that example, you can do it for any attachment type, including images, which is what you get today as an attachment when you subscribe to a Power BI Report or Dashboard. The challenge is if you want an attachment of a full Power BI report, you only get one report page image per subscription. However, you can stitch those items together into a paginated report that’s hosted either in Power BI Premium or SSRS and set that up as a subscription with a full report attachment. Here’s how –
Let’s say I have four report pages total in my Power BI report. I’ll create four subscriptions, 1 for each page.
Next, I’m going to create a paginated report where I show each of those images on a different page. Since they are optimized for landscape, I am going to change my report properties to landscape in Power BI Report Builder.
With paginated reports, you can surface images one of three ways in your report. You can do it either as an embedded image, an external image, or from a Database.
Embedded images are what I used for the Paginated Report Bear sample report – I literally just saved the image files in the rdl you could download. That doesn’t help in this use case.
If I want to use an external images for each of the files, which is a URL image I point to, than I can create a Flow where I save the e-mail attachments from my Power BI subscriptions to a folder in OneDrive (personal), and then use the embed URL from each of those images as external sources for my report. Each time I save a new image with the same name, my embed URL doesn’t change, so I can update the images as often as I like using Flow and my report will always show the latest. I just need to add four images to my paginated report, each with a link to one of the report page URLs, and I’m done!
Anyone who cares about security is going bonkers right now, since sticking them in my personal OneDrive means they’re publicly available to anyone in the world. A better (and safer) solution I’m using is saving them to an Azure SQL database, and then surfacing them as “Database” images in my paginated report. My flow looks like this for that scenario –
What I did here was create a table in an Azure SQL database with three fields, and the Attachment field is an Image field. (This is an admittedly sloppy table written for a blog post vs. production use.) I also narrowed down the scope of the attachments by limiting the flow to those e-mails from the following address (I could be even more precise, but dinner is waiting in the other room) –
Now when my Flow is triggered (it checks my inbox every minute), if it finds a new item matching that rule, I see a new entry in my SQL table like so.
With them saved to a SQL database, I have a few different options how to surface them in my report. Either I do them as standalone items with a page break in between (Check out these two pages when I export out the report out to Word) –
With this method, I’m setting my SQL query to always show the most recent image for each page of my report.
Or perhaps in a table as a collection showing different report states over time if I want to show all the report images
Now, with my images saved in a paginated report, I can load it to either the Power BI service OR SQL Server Reporting Services, setup my subscription, choose the output format (PDF, Word, etc.) and there you have it – full report attachments of my Power BI reports sent as e-mail subscriptions!
Thanks for reading!
One thought on “Use Outlook, Microsoft Flow and Paginated Reports to create Power BI Report and Dashboard E-Mail Subscriptions with PDF attachments”
Very good workaround with well-explained logic!
Comments are closed.