I am trying to set filter on power bi report in create mode. I found the example to set the filter on dataset at report level, page level and visual level but the filter is not working when embed setting is for report creation (Create mode).
Please find the below code which is for power bi report creation.
var embedDiv = document.getElementById('embedDiv');
const iFilters: IBasicFilter = {
$schema: 'http://powerbi.com/product/schema#basic',
filterType: FilterType.Basic,
target: {
column: 'COLUMN1',
table: 'TABLE1'
},
operator: 'In',
values: ['VALUE1', 'VALUE2'],
};
const configuration = {
'accessToken': 'ae...ex',
'embedUrl': 'https://app.powerbi.com//reportEmbed?groupId=group_id',
'datasetId': 'aex....mky'
};
// The below line gives Create Object.
const embedObject = this.powerBIService.createReport(embedDiv, configuration );
embedObject.on('loaded', function(e){
// the below line gives error because setFilter is a method of Report instead of Create class.
embedObject.setFilter([iFilter]);
});
Is any other way to filter the data when we load the dataset for creating the chart?