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.
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:
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:
By "clearing" the slicer, I mean clicking on the eraser button (clearing selections):
Solved! Go to Solution.
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
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
2 | |
2 | |
1 | |
1 |