Filter a Power BI tile on 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: https://powerbi.microsoft.com/en-us/blog/what-s-new-and-what-s-next-for-power-bi-embedded-july-2016/

======================================================================================================================

I received a lot of feedback regarding my two recent posts: https://moraschi.com/2015/12/08/embed-multiple-power-bi-tiles-into-your-web/, and https://moraschi.com/2015/11/30/use-a-power-bi-tile-in-your-web-page/

So I decided to continue in my exploration of the Power BI API. The next natural step in creating customized dashboards is the ability to dynamically filter the tiles based on user interaction. As of today, this is something you cannot achieve in https://app.powerbi.com (you can only filter using selectors in Reports).
There is a post here, with very scarce information about a parameter of the embed API, namely $filter. We can use this parameter much like its oData cousin, with the same syntax.

&$filter={tablename/fieldname}+eq+'{literal constant}’

I tested it for string parameters and it works. Did not have such luck with dates. Everything will eventually come into place, as this API is still under development as I understand.

I created a sample web page trying to keep it very simple, to demonstrate how this works. You can find it here and you are welcome to help yourself reusing my code and adapting it to your needs. In the example you will see a list box, clicking on it will trigger a refresh of the tile with the appropriate results.

Happy coding!

0 thoughts on “Filter a Power BI tile on your web page

  1. Hey Davide, sorry for my ignorance, but I am trying to achieve a similar report filtering as what you have shown.. If my result is currently just the base report without any filtering, do you think that indicates that my embed URL syntax is wrong? Or is there something i possibly need to set up inside the BI report to enable filtering via these URL’s? the syntax i have is https://app.powerbi.com/reportEmbed?reportId=A&$filter=B/C+eq+'D‘ where A = report, B = Table, C = field, D = value.

      1. Thanks for the Tip Davide! Doesnt seem to be a syntax problem, i will research what may be set up incorrectly within our Report guy’s power BI setup.

Leave a Reply

Your email address will not be published. Required fields are marked *