Forum Discussion

simonhobman's avatar
simonhobman
Frequent Visitor
8 years ago

Filtering tile no longer working

Hi all,

 

I've been embedding tiles with a filter for some time.  I append the $filter querystring parameter to the embedUrl.  e.g.  $filter=MyTable/MyColumn+eq+'123'

 

This has been working for probably a year now.  But this morning filtering is not working.  There are no errors logged, the tiles render OK but unfiltered.

 

Does anyone know if there are any issues right now, or if anything has changed with this filter API?

 

Cheers

 

3 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi simonhobman,

     

    Please check whether you hit these limitations when using query string parameter:

    • Field type has to be string
    • Table and field names cannot have any spaces
    • Table and field names are case sensitive. The value is not.
    • Fields that are hidden from report view can still be filtered

     

    Besides, based on my test, we are not able to pass filter parameter to the embedded URL which is created by "Publish to web" feature. 

     

    Best regards,

    Yuliana Gu

    • simonhobman's avatar
      simonhobman
      Frequent Visitor

      Hi v-yulgu-msft Yuliana Gu,

       

      Thanks for the response.  Yes, I can confirm those checks as I've been through all that set up a long time ago.  It's been working since April 2017 and besides a couple of hiccups, it's been fine.

       

      It works by taking the tiles embedUrl and appending a basic filter, such as:

      ?$filter=MyTable/MyColumn+eq+'abc'

       

       

      I can test the filter works by appending it to the URL of the Report in Power BI.com like this: - this is still working!

       

      https://app.powerbi.com/groups/GROUP_ID/dashboards/DASOBOARD_ID/reports/REPORT_ID/ReportSection7?filter=MyTable~2FMyColumn%20eq%20%27abc%27

       

       

      In the past, I've had various encoding issues with the embed url and its filter querystring parameter...

       

       

      In April 2017, before using the JS client, when I was using iframes directly, I would just set the iframe src to the embedUrl directly.

       

       

      iframe.src="@Html.Raw(Model.EmbedUrl)?$filter=MyTable/MyColumn+eq+'abc'";

       

       

      In July 2017, I migrated to the new power bi client but still, I set the embed url as before:

       

      var config = {
        type: 'tile',
        tokenType: models.TokenType.Aad,
        accessToken: '@Html.Raw(Model.Token)',
        embedUrl: "@Html.Raw(Model.EmbedUrl)?$filter=MyTable/MyColumn+eq+'abc'",
      };
      
      var tileContainer = document.getElementById('tileContainer');
      
      var tile = powerbi.embed(tileContainer, config);

       

      In December 2017, our tiles just stopped rendering one day, after debugging we found that there was a URL encoding problem, and we simply replaced the apostrophe with the html encoded version ' which was fine for a while.

       

       

      embedUrl: "@Html.Raw(Model.EmbedUrl)?$filter=MyTable/MyColumn+eq+'abc'",

       

      In January 2018, it stopped again and we quickly sorted it by just encoding the entire url.

      embedUrl: encodeURI("@Html.Raw(Model.EmbedUrl)?$filter=MyTable/MyColumn+eq+'abc'"),

      That's been working up until this week.  As of now, the tiles render, but the tile is not being filtered.  If I log the event.detail from the tileLoaded event, I see there is a reference to a "FilterError", but I can't figure out how to dig into that error.  

       

      ---

       

      I'm really hoping someone might have another idea for me. Otherwise, I think I'm going to have to swap over to the new JS client library and its filter api.  It appears there are two types of embedded charts now, the 'tile' type I'm already using and a new 'visual' type.  It looks like the new visual type supports filtering via the JS library, without url querystring.