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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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 Employee
Microsoft Employee

@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 Employee
Microsoft Employee

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

 

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.