I use Power Bi in an Angular frontend. I call the method in the ngOnInit. I would now like to filter for the “roomId” in a database called ‘persons’ and in a table of the same name “persons”.
If I retrieve the active filter below via getFilters, it is also displayed, but the list is not filtered. Do I have to do something in the Power BI software? The roomId is all filter is somehow set automatically and I can't delete it either. Is it perhaps not overwritten?
public ngOnInit(): void {
this.embedPowerBIReport();
}
private embedPowerBIReport(): void {
const filter: models.IBasicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
filterType: models.FilterType.Basic,
target: {
table: "persons",
column: "roomId"
},
operator: "In",
values: [123]
};
this.embedConfig = {
type: 'report',
id: reportId,
embedUrl: url,
tokenType: models.TokenType.Embed,
accessToken: token,
filters: [filter],
settings: {
panes: {
filters: { visible: true },
// pageNavigation: { visible: false }
},
layoutType: pbi.models.LayoutType.Custom,
customLayout: {
displayOption: pbi.models.DisplayOption.FitToWidth
}
}
};
const reportContainer = document.getElementById('reportContainer');
const report = powerbi.embed(reportContainer, this.embedConfig) as Report;
report.on('loaded', () => {
report.getFilters()
.then(activeFilters => console.log('Active Filters:', activeFilters));
});
}