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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
JagadishNallami
Frequent Visitor

Add event handler for selectionChanged event

I am working on some enbedded power bi report. From documentation I see we can listen for the changes made to a slicer selected values by selectionChanged event. I tried using that but is not working always. It is working randomly. I also didn't find any example showing the full working code for this. Could anyone help on this by providing the working code for this.

 

I tried the below inside the report loaded event. I also tried attaching the event listener for slicer but that didn't worked too.

 

report.on("selectionChanged", function (event) {
console.log(event);
});

 

Please help!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JagadishNallami ,

Base on your description, it looks like you're trying to handle the 'selectionChanged' event for a Power BI embedded report and it is not working. Please change the codes as below and check if it can work...

// Attach event listener for the report loaded event
report.on('loaded', function () {
    console.log('Report loaded');
    attachSelectionChangedEvent(report);
  });

// Function to attach the selectionChanged event handler
function attachSelectionChangedEvent(report) {
  report.on('selectionChanged', function (event) {
    console.log('Selection changed:', event);
  } );

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @JagadishNallami ,

Base on your description, it looks like you're trying to handle the 'selectionChanged' event for a Power BI embedded report and it is not working. Please change the codes as below and check if it can work...

// Attach event listener for the report loaded event
report.on('loaded', function () {
    console.log('Report loaded');
    attachSelectionChangedEvent(report);
  });

// Function to attach the selectionChanged event handler
function attachSelectionChangedEvent(report) {
  report.on('selectionChanged', function (event) {
    console.log('Selection changed:', event);
  } );

Best Regards

Thank you for the response @Anonymous . Will try this

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

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 2025 community update carousel

Fabric Community Update - June 2025

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