Forum Discussion
jdy_ums
2 years agoRegular Visitor
Change Field Parameter value in an embedded app
Hello! I have an app that changes the measure of the charts based on the selected value in the field parameter. It’s working fine from the portal, but how do I change the value of the parameter fi...
Anonymous
2 years agoNot applicable
Hi jdy_ums ,
To change the value of a field parameter in an embedded Power BI report, you can use the setFilters method of the Power BI JavaScript API:
let report = powerbi.embed(reportContainer, embedConfiguration);
// Get the existing filters
let filters = await report.getFilters();
// Find the field parameter filter
let fieldParameterFilter = filters.find(filter => filter.filterType === "FieldParameter");
// Change the value of the field parameter
fieldParameterFilter.values = ["New Value"];
// Apply the updated filters
report.setFilters(filters);
Best Regards