Closed JinaliWijetunge closed 1 year ago
You can use IReportEmbedConfiguration to add filters, then you can add the filters like:
reportConfig: IReportEmbedConfiguration = {
type: 'report',
embedUrl: EMBED_URL,
tokenType: models.TokenType.Embed,
accessToken: ACCESS_TOKEN,
settings: undefined,
filters: [{
$schema: "http://powerbi.com/product/schema#basic",
filterType: models.FilterType.Basic,
target: {
table: "Geo",
column: "Region"
},
operator: "In",
values: ["West", "Central"]
}],
}
please let us know if you have any further questions
Can I do like this? filters: [{ $schema: "http://powerbi.com/product/schema#basic", filterType: models.FilterType.Basic, target: { table: "Geo", column: "Region" }, operator: "In", values: ["West", "Central"] }],
filters: [{
$schema: "http://powerbi.com/product/schema#basic",
filterType: models.FilterType.Basic,
target: {
table: "Geo",
column: "City"
},
operator: "In",
values: ["test1", "City"]
}],
doing a filter on a single table but different columns.
@elgabato , Yes, We can apply filter on single table but different columns. Refer to my sample code as below.
// Create the filter object. For more information see https://go.microsoft.com/fwlink/?linkid=2153364
const filter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Geo",
column: "Region"
},
operator: "In",
values: ["West", "Central"]
};
// Create the filter object. For more information see https://go.microsoft.com/fwlink/?linkid=2153364
const filter1 = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Geo",
column: "State"
},
operator: "In",
values: ["AK"]
};
// Add the filter to the report's filters.
try {
await report.updateFilters(models.FiltersOperations.Add, [filter1,filter]);
console.log("Report filter was added.");
}
catch (errors) {
console.log(errors);
}
For more information refer Control report filters. Feel Free to reach out for any other queries and you can also ask them here Power BI Embedded on Stack Overflow
My question is about how to embed a power bi report with a basic filter. <PowerBIEmbed embedConfig={{
/>
Here type of property filter in IEmbedConfiguration is filters?: models.IFilter[]; but based on my requirement, this should be IReportLoadConfiguration where filters?: ReportLevelFilters[]
How am I supposed to add this configuration