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

Adding Custom Filter to Embed report

I am working on a demo project which uses the powerbi.js file to embed the report.

 

var reportConfig = {
                settings: {
                    filterPaneEnabled: true
                }                
            };

var report = powerbi.embed(reportElement, reportConfig);

 

 

I am trying to create a filter object and set it to the reportConfig's property so the report gets loaded along with the filter.

Below is the basic filter I am creating.

 

 var basicFilterdemo = {
                $schema: "http://powerbi.com/product/schema#basic",
                target: {
                    table: "Query1",
                    column: "Email"
                },
                operator: 'In',
                values: ['test@gmail.com']
            };

 

Can some one help me get a way to configure the filter. 

setting 

var reportConfig = {
                settings: {
                    filterPaneEnabled: true
                },
basicFilter:basicFilterdemo };

 

dint work and also how do I set the level(Report/Page) at which this filter would be set.

 

calling addFilter() inside report.on('loaded',function() works fine but the original report is first loaded and stays there for a couple of seconds and then the change occurs. So that isnt a viable option for me

 

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft
Microsoft

@shivprasads

 

You can create a filter and apply it to the filters properties of the embed configuration. Check Embed Configuration Details.
The problem now is, there's a bug that stops the filters properties from working, check validateReportLoad incorrectly returns schema errors for valid filters. The workaround is, as your mentioned, set the filter after loaded.

Regarding how to set the level(Report/Page), check Understanding the object hierarchy, Both Report and Page have the setfilters function. 

 

View solution in original post

4 REPLIES 4
phaneendhrav
Regular Visitor

@shivprasads:

 

I'm also facing similar issue. Did you get the solution?

@phaneendhrav

No I wasnt able to reach at a viable solution at the time last tested.

 

As per their response,

"The problem now is, there's a bug that stops the filters properties from working, check validateReportLoad incorrectly returns schema errors for valid filters. The workaround is, as your mentioned, set the filter after loaded"

 

The bug could have been fixed.

But if you are implementing it correctly and yet not able to get the filter in place, then lets conclude the bug still exists.

 

You might want to try the workaround I tried mentioned in my query itself, although it wasnt a viable solution for me

Eric_Zhang
Microsoft
Microsoft

@shivprasads

 

You can create a filter and apply it to the filters properties of the embed configuration. Check Embed Configuration Details.
The problem now is, there's a bug that stops the filters properties from working, check validateReportLoad incorrectly returns schema errors for valid filters. The workaround is, as your mentioned, set the filter after loaded.

Regarding how to set the level(Report/Page), check Understanding the object hierarchy, Both Report and Page have the setfilters function. 

 

View solution in original post

So you mean the entire filter property isnt working for now when setting it up in the embed configuration.

And the way I have done with the function being called at the load event is the way we need to do, at least for now?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors