Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
SMutlow
New Member

Passing a filter to an iFrame

HI there.

 

I have been tasked with testing the integration of Power BI with a Web App we are developing.

Using the code on github:
https://github.com/PowerBI/Integrate-a-tile-into-an-app

I have a SQL data source attached to a report in Power BI.

I need to filter the report at run time based on one of the columns and following the example here:
http://blogs.msdn.com/b/powerbidev/archive/2015/09/23/power-bi-api-updates-roundup.aspx

Specifically the example code:

https://app.powerbi.com/embed?dashboardId=c2411ca0-f4fc-4b6f-b2f1-02f62281290d&tileId=9a6b1f88-08b6-47c4-986d-d185b9fa9fbb}&$filter={FieldName} eq '{FieldValue}'

In your example above there is a curly bracket "}" just before "&$filter", I expect this is a typo?

The report is retrieved but the filter has not been applied.


As my column is an int I have tried:

iframe.src=embedTileUrl + "&$filter=tblDataSnapshot/StoreId eq " + storeId + "&width=" + width + "&height=" + height;

and

iframe.src=embedTileUrl + "&$filter=tblDataSnapshot/StoreId eq '" + storeId + "'&width=" + width + "&height=" + height;

Ive tried putting the filter both before and after the height and width code, removing the height and width code.

Ive tried &filter, &$filter and a 100 other variations of OData combinations.

 

Can I get some clarification on the correct syntax please?

10 REPLIES 10
rishab1992
Regular Visitor

Is there a way to pass multiple filters for a tile. We are able to filter the data using one filter only and when we tried to pass multiple filters it didn't work. There should be a way to pass multiple filters to an embedded tile

 

Hi,

 

I have also tried with <iframe width="800" height="600" src="https://app.powerbi.com/view?r=ReportURL"+"&filter=Tablename/columnname eq 'Value'" frameborder="0" allowFullScreen="true"></iframe>

 

but it's not working. how to solve this issue.

 

My requirement is "I have published all user's dashboard via publish to web in power bi. and published URL implemented in html page via IFRAME.

Now I wants to get specific user dashboard . How it is possible."

 

 

Thanks in Advance......

Did you had any luck with sharing this for specific users (filtering by custom user table credentials)?

Did not have any luck getting the filter to work at all.

Used Google charts instead as trying @davidem 's suggestion / post did not work for me and there was no clarification from Microsoft at the time. Albeit I have not looked at this issue since so doubtless their documentation must have improved since.

I really tried to make this filter work, but it didn't work so is there a way to pass any filter outside the power BI service world. 

 

<iframe width="1000" height="2000" src="https://app.powerbi.com/view?r=eyTBjMTlkNyIsImMiOjF9&filter=main/cityname eq 'Aleppo'" frameborder="0" allowFullScreen="true"></iframe>

 

Not sure if query string feature is enabled with the embededd URLs. 

davidem
New Member

Hi all, please see my post: Filter a power BI tile on your web page


Davide Moraschi
https://www.amazon.com/author/davidem
http://moraschi.com

 

 

@davidem Thanks very much for the helpful example. I'm almost sure this is the solution.

However I cannot as yet get it working, I suspect it is because I am using a free account to test with.

I am only able to see the dashboard I created back in October last year, new reports also are not showing when I use the latest code example project here (PowerBI-CSharp-master\samples\webforms\embed-a-tile-into-an-app): https://github.com/Microsoft/PowerBI-CSharp

 

@davidem the account you are using in that example is a free or pro account?

@SMutlow thanks. I also had problems with the CSharp code. I don't recall but I think it was related to the access token not being created properly. See also my articles about OAuth from a bash script to get some hints. Or this preview feature that may also be useful https://moraschi.com/2016/02/05/power-bi-publish-to-web-now-in-preview/

 

best regards

Davide

 

BTW I'm with a Pro account, but should not make difference, the APIs work just the same


Davide Moraschi
https://www.amazon.com/author/davidem
http://moraschi.com

@davidem surely if my access token was incorrect I wouldnt see anything.

I am able to get the tile injected onto the page with both the example code and the javascript version in your example the only thing that is not working is the filter. All I see is the unfiltered tile while the oAuth syntax is seemingly correct.

karldink
New Member

As with SMutlow, I've also tried various combinations of the "filter" capability in ODATA syntax to filter data in a tile (based on the filter query string options at 4.5 in this page http://www.odata.org/documentation/odata-version-2-0/uri-conventions/). Nothing that I've tried has worked.

 

Please can we get some further information on how to get the "filter" capability working?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors