cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SMutlow Frequent Visitor
Frequent Visitor

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
karldink New Member
New Member

Re: Passing a filter to an iFrame

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?

davidem Frequent Visitor
Frequent Visitor

Re: Passing a filter to an iFrame

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
SMutlow Frequent Visitor
Frequent Visitor

Re: Passing a filter to an iFrame

 

 

@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?

davidem Frequent Visitor
Frequent Visitor

Re: Passing a filter to an iFrame

@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
SMutlow Frequent Visitor
Frequent Visitor

Re: Passing a filter to an iFrame

@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.

rishab1992 Frequent Visitor
Frequent Visitor

Re: Passing a filter to an iFrame

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

swathiOnteddu New Member
New Member

Re: Passing a filter to an iFrame

 

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......

Highlighted
hjameelq Regular Visitor
Regular Visitor

Re: Passing a filter to an iFrame

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. 

Thomas Frequent Visitor
Frequent Visitor

Re: Passing a filter to an iFrame

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

Helpful resources

Announcements
Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 316 members 3,538 guests
Please welcome our newest community members: