Forum Discussion
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
- davidemNew Member
Hi all, please see my post: Filter a power BI tile on your web page
- SMutlowNew Member
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?
- davidemNew Member
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
- karldinkNew 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?
- rishab1992Regular 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
- swathiOntedduNew Member
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......
- hjameelqAdvocate IV
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.