Forum Discussion

JinHe's avatar
JinHe
Frequent Visitor
1 year ago
Solved

[powerbi-client-react] Is there a way to modify the selected value of the filter?

I integrated a report using powerbi-client-react, and the customer requested to extract some common filters that can be filtered externally, It is best to have internal and external filter linkage.  ...
  • Anonymous's avatar
    Anonymous
    1 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:

    1. You can listen to the filtersApplied event on the report. This helps detect when filters have been changed (like from a slicer).
    2. 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.
    3. 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