Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Cobra77
Post Patron
Post Patron

Power BI Embedded replace a value of one filter out of 5

Hi,

 

How ( and best pratice ) to get filters ( actually 5 filters report on our reports ) , remove one filter only and add the new value , or replace directly the value just for this filter ? 

and keep the 4 others filter.

 

And the filters are of different types.

 

And it is possible on pagefilter ?

 

Thanks for your helps.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I am assuming you are talking about report level filters. 
What you can do is use getFilters() to get the current filters array. 
Then if you want to modify the value of the filter just modify the value within the array. 
You can use the constructors to create a new filter and add in the array. 
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters#constructing-filters
Similarly you can remove the filter from the array. 

Once you are done with the modifications, you can pass the updated array to the report using setFilters() function.

You can do the same for page and visual level filters too. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

I am assuming you are talking about report level filters. 
What you can do is use getFilters() to get the current filters array. 
Then if you want to modify the value of the filter just modify the value within the array. 
You can use the constructors to create a new filter and add in the array. 
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters#constructing-filters
Similarly you can remove the filter from the array. 

Once you are done with the modifications, you can pass the updated array to the report using setFilters() function.

You can do the same for page and visual level filters too. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.