Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Describe the bug
on load report, I'm setting the filters as described in the example but I get the following error:
{message: "undefined property is invalid"}
To Reproduce
Try to set filters on loading report
Here my code:
const report = this.powerbi.embed(embedContainer, config);
this.report = report;
report.on("loaded", function () {
report.getPages().then(function (pages) {
var k = ($('#embedContainer').width() - 2) / pages[0].defaultSize.width;
$('#embedContainer').height(pages[0].defaultSize.height * k)
});
const firmName = $("#FirmName").val();
report.getFilters()
.then(filters => {
let firmFilter = {
"$schema": "http://powerbi.com/product/schema#basic",
"target": {
"table": "Firm",
"column": "Firm Name"
},
"operator": "In",
"values": [
firmName
],
"displaySettings": {
"isHiddenInViewMode": "true"
}
};
filters.push(firmFilter);
report.setFilters(filters)
.catch(function (errors) {
console.error("Set filter error: ", errors);
});
});
});
I found a solution by simply deleting the quotes in property names. But the question is, why did it work before?
Hi @Anonymous ,
Please refer to: https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters for more information on how to use the SDK to apply filters.
You can also set filters during load.
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details
You can see a working demo of using filters here:
https://microsoft.github.io/PowerBI-JavaScript/demo/filters.html
If the filters you are applying need to be secure (they can't be modified by the client) then you must use RLS on the report, and then add the username and/or role claims to your JWT token. Then requests to view the report with this token will only show data for allowed user or role.
The OData $filter parameter only supports a subset of filter capabilities. If you want to have more complex values or conditions it is recommended to use the SDK to construct filter objects.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
3 | |
3 | |
3 | |
3 |