Forum Discussion
Getting selected element in a Power BI report from API
- Anonymous6 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.
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.
Thank you very much, this looks like exactly the kind of reference I need. I only ever got the REST API which did not seem capable of solving the issue for me but this seems like it should be able to handle the job.