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: http://moraschi.com/2015/12/08/embed-multiple-power-bi-tiles-into-your-web/, and http://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!

15 Replies to “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.

  2. Hi Davide,
    Where is the Filter placed in the report, at the Visual Level, Page Level, Report level or somewhere else ? or no filter at all ?

    thank you

  3. Hi Davide,
    Where is the Filter placed in the report, at the Visual Level, Page Level, Report level or somewhere else ? or no filter at all ?

    thank you

    1. Actually in the example I’m filtering a tile, not a report. But to answer your question: I would put no filter at all in the report. Only in the embed url
      regards

    1. Hi there, I’m using the same syntax embedded in an iframe but it doesnt work..
      Did you manage to get it work in an iframe?
      My code is

  4. Hi there, I still can get the filtered url to work on a single field (I’m filtering a report)
    This is the code I’m using:

Leave a Reply

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