Forum Discussion
Power BI embedding - Set and replace filters at embed time (config object)
Hi nazanael1,
I check the document about embedded config and find it include filters option, I think you can use it to setting the filters:
Use filters when embedding a report in Power BI embedded analytics | Microsoft Learn
var basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Table",
column: "Column"
},
operator: "In",
values: [1, 2, 3, 4]
}
var config = {
type: 'report',
accessToken: 'access-token',
embedUrl: 'https://app.powerbi.com/reportEmbed?reportId=report-id',
filters: [basicFilter]
};
var reportContainer = $('#reportContainer')[0];
var report = powerbi.embed(reportContainer, config);
Regards,
Xiaoxin Sheng
Hello,
That is what we want to do. The issue doing it this way is that it does not overwrite the default filter. In the image, the report after being embedded. In the original report, the Filter is set as "Light".
Doing what you explained, I changed to "Dark", but it is not being replaced, just adds it twice (Even having Require single selection).
Original (Power BI Service)
Embedded: After adding "Dark" in the config
We expected here to remove the Light and add the Dark filter.
That is why I wanted to use ReportOnLoadFilters, to be able to replace the previous one.
Is there any way to replace it using the config object?