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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Knuckles
Regular Visitor

Power BI Embedded Filter Problem

hi

 

i try to create an angular 2 application with Power BI Embedded report.

I create a dashboard with a Report level filter on a Function Table that is used to retrive the data.

I use this code, with javascript, to set the report

 

var m = { 
                    action: "loadReport",
                    accessToken: response.AccessToken,
                    height: h, 
                    width: w,
                    oDataFilter:'CountryRegion eq "United States"'
             };

but when the report is show the filter is not set (but work when the user click on it)

 

Any suggestion?

 

Thanks!

1 ACCEPTED SOLUTION

@Knuckles

 

Both adding the parameter in JS or adding query in embeded URL work in my test.

 

In JS, a format as below should work, DO NOT mess the single quote and double quotes. You can add an alert to debug the passed JSON.stringified message.

oDataFilter:'CountryRegion eq "United States"'
oDataFilter: "<table>/<column> eq '<filtervalue>'"

 

One thing important is that <table>/<column> is case-sensitive. Make sure you've specified the correct names.

 

View solution in original post

4 REPLIES 4
jocaplan-MSFT
Employee
Employee

The filter needs to be set as a query string parameter on the embedURL.

thanks for your reply

 

i try this

 

iframe.src=response.Report.embedUrl +"&$filter=CountryRegion/CountryRegionName eq 'United States'";

but doesen't work....

@Knuckles

 

Both adding the parameter in JS or adding query in embeded URL work in my test.

 

In JS, a format as below should work, DO NOT mess the single quote and double quotes. You can add an alert to debug the passed JSON.stringified message.

oDataFilter:'CountryRegion eq "United States"'
oDataFilter: "<table>/<column> eq '<filtervalue>'"

 

One thing important is that <table>/<column> is case-sensitive. Make sure you've specified the correct names.

 

thanks!

 

the problem was the single quote and double quotes!

 

Now all works!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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