Forum Discussion
[powerbi-client-react] Is there a way to modify the selected value of the filter?
- Anonymous1 year ago
Hi JinHe ,
Thanks for the follow-up! You're correct, Power BI’s current embed API doesn't directly support setting default selected filter values inside a slicer or tracking filter changes via a dedicated filterApplied event.
However, we can achieve the same goal using a combination of available tools.
You can pass filters from your external UI into the embedded Power BI report using setFilters() or updateFilters(). This means when a user selects something in your custom dropdown (like "Cambridge" or "Harlow"), you can apply that selection inside the report.
While you can't define "default selected" items directly in the filter model, you can simulate it by automatically applying a filter right after the report loads.
There's no direct event like filterApplied, but there are workarounds:
- You can listen to the filtersApplied event on the report. This helps detect when filters have been changed (like from a slicer).
- If you're using a slicer visual, you can use getSlicerState() to check what values are selected, and use that to update your external UI accordingly.
- You may also consider calling getFilters() when needed to fetch current filter states.
Use slicers in Power BI embedded analytics | Microsoft Learn
GetSlicerState from a Custom Slicer - Microsoft Fabric Community
If the issue still persists, I’d recommend raising a support ticket with Microsoft. The support team can look into the backend and provide more in-depth assistance tailored to your environment.
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticket
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Regards,
B Manikanteswara Reddy
Hi JinHe ,
Thank you for reaching out to Microsoft Fabric Community Forum.
It looks like the issue you're facing is very similar to one that other users encountered earlier. Those issues have been resolved, and the solutions might be helpful in your case as well.
Solved: Power BI Embed in React app - Microsoft Fabric Community
Solved: Embedded Report add filter to EmbedConfig - Microsoft Fabric Community
Embed Power BI on React App with filters coming fr... - Microsoft Fabric Community
The last one was not closed, but solution might helpful for our scenario.
Please refer to the posts linked below for the full explanation and steps:
Use filters in a Power BI embedded analytics report | Microsoft Learn
How to embed a Power BI item in a React app | Microsoft Learn
CategoryEntry.FilterApplied Event (System.Activities.Presentation.PropertyEditing) | Microsoft Learn
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
Sorry, there is no solution that meets my needs.
const basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Store",
column: "Count"
},
operator: "In",
values: [1, 2, 3, 4],
filterType: models.FilterType.BasicFilter
};Because there are two problems that cannot be solved:
- Please see the official filter model above. The default selected item cannot be defined in the filter model.
- Cannot find the ‘filterApplied’ event in the embedConfig.
- Anonymous1 year agoNot applicable
Hi JinHe ,
Thanks for the follow-up! You're correct, Power BI’s current embed API doesn't directly support setting default selected filter values inside a slicer or tracking filter changes via a dedicated filterApplied event.
However, we can achieve the same goal using a combination of available tools.
You can pass filters from your external UI into the embedded Power BI report using setFilters() or updateFilters(). This means when a user selects something in your custom dropdown (like "Cambridge" or "Harlow"), you can apply that selection inside the report.
While you can't define "default selected" items directly in the filter model, you can simulate it by automatically applying a filter right after the report loads.
There's no direct event like filterApplied, but there are workarounds:
- You can listen to the filtersApplied event on the report. This helps detect when filters have been changed (like from a slicer).
- If you're using a slicer visual, you can use getSlicerState() to check what values are selected, and use that to update your external UI accordingly.
- You may also consider calling getFilters() when needed to fetch current filter states.
Use slicers in Power BI embedded analytics | Microsoft Learn
GetSlicerState from a Custom Slicer - Microsoft Fabric Community
If the issue still persists, I’d recommend raising a support ticket with Microsoft. The support team can look into the backend and provide more in-depth assistance tailored to your environment.
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticket
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Regards,
B Manikanteswara Reddy