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
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.
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