One of the problems we hit today was getting a Power BI to automatically refresh. The underlying data is updated every 5 mins, however the actual Power BI only refreshes when the user interacts with the report despite using DirectQuery. To overcome this, we’ve built a simple HTML page that used a bit of JavaScript magic to force a refresh and the new Secure Embed feature.

First, we need to get a code for the report, open the report then click File > Embed (You can select ‘Publish to web’ - this means you don’t need to login to view the report, however anyone in the world could access the report)

Embed

Once you’ve selected embed, you need to copy the iframe code

Embed code

You then need to put this iframe code into a HTML file. Below is a Gist for basic HTML page with the JavaScript magic to force a refresh every 1 min.

If you copy the code below into notepad inserting the iframe code then saving it as a .html (for example report.html)

One thing worth changing on the iframe code Power BI generates is changing the frame size.

to

This is allow Power BI to use the full web browser real estate. You can ofcourse use F11 to make most web browsers go full screen. Great for displaying Power BI on the big screen!