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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
semptra
Frequent Visitor

Deselecting report slicer does not propagate "dataSelected" event

We are using powerbi-client-angular (https://github.com/microsoft/powerbi-client-angular) to embed Power BI reports for our customers.

 

We have 2 reports - "Report A" and "Report B". Both of them have a slicer with the same name and target (filters data in the same table and column). Embedding code looks something like this:

HTML:

 

 

<powerbi-report
    [embedConfig]="reportEmbedConfig"
    [eventHandlers]="reportEventHandlers">
</powerbi-report>

 

 

 

TypeScript:

 

 

const reportEmbedConfig =  {
        type: 'report',
        tokenType: models.TokenType.Embed,
        accessToken: null,
    };

const reportEventHandlers = new Map<string, EventHandler | null>([
    ['loaded', async (event) => await this.onReportLoaded(event)],
    ['dataSelected', (event) => this.onReportDataSelected(event)]
]);

 

 

 

Parent component than uses inputs for "ReportName" and "Slicers" based on which the proper report with the slicers is loaded:

 

 

this.reportName$.pipe(
    tap(() => this.isReportLoaded = false),
    switchMap(newReportName => getPowerBIReportEmbedParameters(newReportName)),
    takeUntil(this.onDestroy$)
).subscribe(embedParameters => {
    const reportSlicers = this.getReportSlicersConfiguration(this.reportName);
    this.reportEmbedConfig = {
        ...this.reportEmbedConfig,
        embedUrl: embedParameters.embedItem.embedUrl,
        accessToken: embedParameters.embedToken.token,
        slicers: reportSlicers
   };
});

 

 

 

So, the user can switch between the reports, and the Slicer should be transferred from one report to the other.

 

However, in the following scenario, we have an issue:

  1. User opens "Report A"
  2. User selects value "Value A" on the Slicer
  3. User switches to the "Report B"
  4. User deselects "Value A" on the Slicer

When the user selects value in step 2, "dataSelected" event is property triggered. However, on the step 4, after deselecting the value, "dataSelected" event is not triggered. If the User instead selects another value on the Slicer and then tries deselecting again, the "dataSelected" event is triggered property. It's just not working for the first time. Note that clearing the Slicer by pressing the eraser button works just fine.

 

What's going on there? Is there something wrong on our side or on the Power BI side.

 

Update.

 

By saying "deselect" I mean clicking on the already selected value in the slicer, for example in this case clicking on the "Abbas MA-03) value:

semptra_0-1683129284031.png

 

By "clearing" the slicer, I mean clicking on the eraser button (clearing selections):

semptra_1-1683129329935.png

 

1 ACCEPTED SOLUTION
semptra
Frequent Visitor

1 REPLY 1
semptra
Frequent Visitor

Please close this since I've created an easier repro steps for this here - https://community.powerbi.com/t5/Developer/quot-dataSelected-quot-event-not-triggered-on-deselect

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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