Forum Discussion

-Rem-'s avatar
-Rem-
Frequent Visitor
6 years ago
Solved

Getting selected element in a Power BI report from API

I am looking to get what item has been selected in Power BI and to send that information to a program outside of Power BI. Previously, I have done this in connection with PowerApps. Using PowerBIInt...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi -Rem- 

    if you are using the PowerBI Javascript API to perform the embedding - then you can use the 'Events' capability within reports.
    https://github.com/microsoft/PowerBI-JavaScript/wiki/Handling-Events

    Registering to the 'dataSelected' event will let your application handle selections that it is interested in.
    It can a little bit fiddly to filter out the noise to find only the events you are interested in - but this technique is reliable and works very well.

    Another possible option is to use the 'Commands' API -> https://github.com/Microsoft/PowerBI-JavaScript/wiki/Commands
    This will let you extend the context/header menu on some visuals. You can then acces the datapoints that are currently 'in focus' and perform actions in your app that way.

    Hope this helps.