Forum Discussion
Embedded Analytics API, Data Selection from graph
- 1 year ago
Hi joshbrown ,
Thanks for reaching out to Microsoft Fabric Community and sharing the scenario.
From your description, it looks like you're embedding a Power BI report using the powerbi-client-react library and capturing selected values from visuals for further DAX query generation.
In many cases, capturing selected values works fine when the visual is based on model-bound fields and the selection clearly maps to a data identity. However, there are known limitations when interacting with certain visuals like matrices (especially totals or headers), KPIs, or custom visuals. These may not return the expected value in the selection response or may not emit a usable selection context at all. Additionally, as per official documentation, range and relative slicers are not supported for selection capture and won’t emit identity objects in the response. This behavior is expected and is documented here:
How to handle events in a Power BI embedded analytics application | Microsoft Learn
The ability to capture selected data usually depends on how the interaction is handled in the frontend. If you're using the JavaScript SDK event handlers (for example, something like the dataSelected event), the response can vary based on the visual and how the data is bound. Some visuals don’t expose identity or value in a way that can be retrieved through interaction alone.
A possible approach you can try is to use the getData() method on the visual instance after the user interaction. This method allows you to programmatically access the data behind the visual and may help retrieve the value even when it’s not directly returned in the selection event.
Currently, there is no complete public documentation listing which visuals are fully supported for selection capture. In general, standard visuals like bar charts, tables, and pie charts behave as expected, while some visuals like KPIs or matrix headers may not provide the desired selection output.
Some related discussions which you may find similar,
Solved: Power Bi embedded - interaction through dataSelect... - Microsoft Fabric Community
Power BI Embedded dataSelected event not triggered - Microsoft Fabric Community
Suddenly dataSelected event not getting fired for ... - Microsoft Fabric Community
Hope this helps. Please reach out for further assistance.
If this post helps, then please consider to give a kudos and Accept as the solution to help the other members find it more quickly.
Thank you.
Hi joshbrown ,
Your approach for retrieving selected values from Power BI reports using the Embedded Analytics API makes sense and matches how simple visuals (like tables or pie charts) are intended to work. For your specific questions:
For cases where selection on a visual doesn’t yield the expected data in the Embedded Data response:
This usually happens with visuals that do not fully expose their selection context through the API. Some visuals, especially custom visuals or complex ones, may only return partial context—like row/column indexes instead of the actual values. As a workaround, you might need to:- Check the visual type and, if possible, map the selection context (such as identities or indexes) back to your data model using additional queries or dataset information.
- In some cases, using bookmarks or capturing user interactions at the report level can help, but it’s not always straightforward.
- There isn’t always a direct way to craft a DAX query for data that isn’t exposed in the Embedded Data response.
Regarding documentation for supported visual objects:
The official documentation doesn’t provide a full list of which visual types support complete selection data in the Embedded Analytics API. Generally, standard visuals (tables, matrices, basic charts) are well supported, but custom visuals and some advanced visuals may have limitations.- It’s a good idea to test the visuals you plan to use and check the API response for each.
- Also, keep an eye on the Power BI API documentation and community forums for updates, as support can change over time.
For your frontend, using the PowerBI Client React library is a solid choice.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.