Use a Power BI Tile in your web page

EDIT 2016-07-12: Microsoft has changed their API and policies and functionality, so this artcile is obsolete now. I will shut down the sample site. For details, please see:


Creating dashboards is more witchcraft than art and more art than science. Think about how many times you have banged your head to produce a useful chart according to the specs of your client. You have the numbers, you have the chart and everything in place but the customer keeps saying: “it’s just not the right shade of green…”

Many times we have to create custom web pages to accomplish what the BI solution can’t offer out of the box; and Power BI provides you just that, the ability to use a tile from a dashboard without forcing the customer to open the entire Power BI user interface. With this technique you can embed just a piece of a bigger BI report into an HTML page. It’s not very straightforward (at least for me it wasn’t), and I must say that the documentation often makes it worse (there’s an errata in the GET REST Uri of the Step 3 – Get user’s tile information).

So you want to embed a Power BI Tile into a web page: to quickly see how it works go to this example page. If you want more details, just read on.
I assume you already have a Power BI dashboard and you know how to get an access token. This is probably the most difficult part and I covered that in another article.

I am using cURL from a headless EC2 server just for sake of simplicity, you can do this with your favorite programming language.

First step is to get the ID of your dashboard:


curl -k -X GET "" -H "$AUTH_HEADER_LOCAL"


where $AUTH_HEADER_LOCAL is the “Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiI……..” you created when asking for an access token.

The server will respond something like this:

From here you need to extract the id element which represents your dashboard.

Second step is to get the tile ID:




where $AUTH_HEADER_LOCAL is the same as above and ${DASHBOARD_ID} is the value you got in step 1.

the answer will include an element named “embedUrl” which is the link to your tile.

Now that you have the embedUrl and the access token, you can build a simple HTML page:

  • Create an <iframe> element that will host your tile
  • Have your access token ready into a variable, I personally have it in an external .js file that I load as a <script> inside the page
  • Add a <script> element to activate the <iframe> with the access token and the dimensions of the tile

[code language=”javascript”]
<script type="text/javascript">
var width = 800;
var height = 600;
var embedTileUrl = "…..2618e&tileId=8cd8bc5….7624a";

window.onload = function () {

function updateEmbedTile() {
if ("" === embedTileUrl)
iframe = document.getElementById(‘iFrameEmbedTile’);
iframe.src = embedTileUrl + "&width=" + width + "&height=" + height;
iframe.onload = postActionLoadTile;

function postActionLoadTile() {
if ("" === accessToken)
var h = height;
var w = width;
var m = { action: "loadTile", accessToken: accessToken, height: h, width: w };
message = JSON.stringify(m);
iframe = document.getElementById(‘iFrameEmbedTile’);
iframe.contentWindow.postMessage(message, "*");


Note that the access token will expire after 1 hour, so you need to have a way to refresh it on the server side.

Feel free to use as a reference.

Twitter Trending Topics by Location, Date (PowerBi WordCloud)

Twitter Trending Topics by Date, Location

One of the things I like the most about Power BI is the ability to use custom visuals. I did not try building one myself and honestly I think it’s beyond my skills, yet there is a gallery with a growing number of pre-build viz that you can download and use.

Go to and take a look.

I downloaded the WordCloud plus the Chiclet Slicer to create a report showing the trending topics in Twitter sliced by date and location.

Only few locations are available from Twitter API, here is a sample of spanish cities I am monitoring.

Happy tweets!

Microsoft Power BI to be generally available on July, 24 2015

Few days ago microsoft announced that the preview phase of Power BI is now over and the product will be launched later this month.

The Power BI that was available in SharePoint and Office 365 will be superseded. This means that Power View (the Silverlight powered dashboard) will cease to exist.

<my personal note>Given that Microsoft recently aquired DATAZEN, I suppose this Power BI will also have a very short life-span.</my personal note>

It will feature a Desktop component and a cloud based hosting service. Free accounts for up to 1GB of data.

It will be able to access both on-premise and cloud data and more connectors will be added after the launch. One point worth noting is that Microsoft released the code of the visualizations on GitHub, allowing developers to add their own D3.js (or other javascript) based charts under MIT license. This means that we could write plug-ins to embed into Power BI, but I have no clear idea whether we’ll be able to embed Power BI functionalities in our own web pages/applications.

What is your overall impression with this new BI tool?

Please answer a couple of questions here: