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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
joshbrown
New Member

Embedded Analytics API, Data Selection from graph

My organization is developing an integration which allows users to select data from a Power BI report user interface and generate a DAX query to the selected value.

  • The user would select an object on the report (pie graph, table, etc.) and
  • That value would be returned in the body of the Embedded Data response.
  • We then write a DAX query to that value and store it for future queries.

We have observed that for simple objects, this is straightforward and works fine. We are able to retrieve the value easily for the Embedded Response.

 

However, there are cases which do not return this value and the documentation is elusive. What I would like to know is

 

  • Is there a work-around to craft a DAX query to an object on the table which the user selects, but does some kind of row or column selection and doesn't actually get the targeted and desired value and return it in the Embedded Data response?
  • Is there documentation for what types of visual objects that Embedded Analytics API supports and does not support?

For the front end we are using PowerBI Client React library: https://www.npmjs.com/package/powerbi-client-react

1 ACCEPTED SOLUTION
v-veshwara-msft
Community Support
Community Support

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.

 

 

View solution in original post

5 REPLIES 5
v-veshwara-msft
Community Support
Community Support

Hi @joshbrown ,

We’re following up regarding your query. If it has been resolved, please mark the helpful reply as the Accepted Solution to assist others facing similar challenges.

If you still need assistance, please let us know.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @joshbrown ,
Could you please let us know if your query has been resolved and if the response provided was helpful? Feel free to reach out if you need any further assistance.

Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @joshbrown ,

Just checking in to see if you query is resolved and if any responses were helpful. If so, kindly consider marking the helpful reply as 'Accepted Solution' to help others with similar queries. 

Otherwise, feel free to reach out for further assistance.

Thank you.

v-veshwara-msft
Community Support
Community Support

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.

 

 

burakkaragoz
Community Champion
Community Champion

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:

  1. For cases where selection on 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 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 direct way to craft DAX query for data that isn’t exposed in the Embedded Data response.
  2. Regarding documentation for supported visual objects:
    The official documentation doesn’t provide 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 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 solid choice.

If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, would be grateful for 'Kudos' if you found my response helpful.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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