Tags: Power BI
Back in March of 2015, DB Best published a blog post on how to embed Power BI Power View interactive reports into your blogs and websites. Much has changed in Power BI since then to make it possible to easily embed reports into your blog articles. There are now two basic options for embedding reports. Power BI Embedded is a service on Azure for publishing Power BI visuals and uses authentication to make sure users can see the data they are supposed to. The other method is to use the new Publish to web feature introduced in the October 2016 release of Power BI. The downside is that you can’t authenticate users to view the report. For the most part, this is perfect for blog posts and social media.
So you have a really cool Power BI Report that you want to share with others. You could always do a static screenshot of the dashboard like the one below.
Let’s see how you can add the interactive Power BI experience within a blog post.
Here is an example of a visualization based on the data from the original post that now works. More importantly, since Power BI is now rendered using HTML5, you no longer need to download Silverlight to display the visualization. The visual allows you to publish a multi-page report. At the bottom of the example below, you will notice that page 2 is the current page for the report. Note, the report below is fully interactive!
The visualizations shows the TOP 5 registered female and male first names per state, as per SSA.GOV for 1910 – 2015. The entire dataset is available as a ZIP file at https://www.ssa.gov/oact/babynames/state/namesbystate.zip. The zip file contains comma delimited files for each year since 1879 as of March 6, 2016.
So, how did we do this? The workflow was pretty straight forward. Here is what we did.
Preparing the data
- Downloaded the ZIP file at https://www.ssa.gov/oact/babynames/state/namesbystate.zip and unzipped the text files into a directory.
- Started the Power BI Desktop and Get Data feature by selecting the Folder option.
- Selected the folder name with the 50 text state files.
- Edited the query. Otherwise the Load operation would have imported just the file name metadata.
- Issued the Combine Binaries command which appends all the files together. Check out https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-november-feature-summary/#combineBinaries for more info on Combine Binaries.
- Verified the data was formatted correctly.
- Renamed columns after the import and adjusted data types.
- Issued the Load/Save command and watched how Power BI imports the data into the model.
Building the report
- Added a table object and added First Name and Occurrences fields to the table. Then, dragged the Gender field into the Visual level filters section and set the value to F. Then, set the Filter Type to Top for the First Name, set the number Show items to 5 and the By value to Occurrences. NOTE: the TOP N Filter feature was added in the October 2016 release.
- Embellished the report as shown in the embedded Power BI report and used the Publish command to upload it to our DB Best Power BI tenant.
- Clicked on the link to navigate to My Workspace where I uploaded the report and then used the File -> Publish to Web command.
- Copied the HTML text for the iframe. We can use it for embedding the report in a web page.
It’s just that simple. You can add the HTML to any application that supports iframes. We hope you found this post helpful. If you want to download the Power BI report that we created for this blog post, check out