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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
momo
Regular Visitor

Javascript SDK - Catch multiple data selected events across multiple charts

I have an embedded report with multiple charts. It's possible to select multiple data points accros multiple charts using Ctrl+click. I would like to catch such multiple data selected events using the javascript SDK. When adding an event listener "dataSelected" I can just catch the latest data selected event, not the multiple data selected events. I can catch multiple data selected events in one single chart but not accros multiple charts. Is there a way to do it ?

4 REPLIES 4
dmarkham
Frequent Visitor

I'm also interested in this, but do not see a solution.. has any been found?
Thanks!

momo
Regular Visitor

On embedded report with multiple charts, it's possible, since February 2018 release, to select multiple data points accros multiple charts using Ctrl+click. It should be possible to catch such multiple data selected events using the javascript SDK by adding an event listener "dataSelected". Unfortunately, it seems it's not the case today.

v-micsh-msft
Microsoft Employee
Microsoft Employee

How you define the DataSelected Events here?

If you would like to get the history data, then you may need to create an array to hold the data selected previously.

 

I believe the DataSelected Event captures every click, but in your code it only returns the last Event information.

 

You may consider add a log function similar to the Power BI Embed sample, which would log every steps with user interaction.

Code example:

// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];
 
// Get a reference to the embedded report.
report = powerbi.get(embedContainer);
 
// Report.off removes a given event listener if it exists.
report.off("dataSelected");
 
// Report.on will add an event listener.
report.on("dataSelected", function(event) {
    var data = event.detail;
    Log.log(data);
});
 
// Select Run and select an element of a visualization.
// For example, a bar in a bar chart. You should see an entry in the Log window.
 
Log.logText("Select data to see events in Log window.");

Regards,

Michael

Thank you Michael for your answer!

 

I catch all the DataSelected events using code similar to the Power BI sample. I can store the full events history but this doesn't help me as I don't know if it was a simple click or a ctrl-click which throw the event. With a simple click, only the last data point is selected. But with a ctrl-click, multiple data points are selected (with AND logic between data points on different charts. This is visible graphically on the embedded report).

 

I compared the JSON returned in events and could see no differences between a click event and a ctrl-click event (on multiple charts).

 

Best regards,

François

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors