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.
Hello,
I have implemented a custom visual slicer and want to appy a filter (ISlicer with selector of type slicerTargetSelector) to that slicer in embed configuration on report load. Before the report finishes loading the error "slicerTargetDoesNotMatch" is logged in the browser console. The target is correct because with the standard slicer it works.
Is there something missing or exists a limitation?
Thanks in advance.
Hello,
Are you talking about embeded API configuration? Could you please provide more details and probably screens regarding your issue?
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Hello,
yes the power bi report should be loaded with power bi embedded API.
The error event handler of the report object is called while loading the report:
var reportContainer = document.getElementById('reportContainer'); var report = powerbi.load(reportContainer, embedConfig); report.on("error", function (event) { console.log(event); });
The slicer state in the embed configuration object:
{ "selector": { "$schema": "http:\/\/powerbi.com\/product\/schema#slicerTargetSelector", "target": { "column": "Overdue Wesentlichkeit", "table": "Overdue Wesentlichkeit" } }, "state": { "filters": [{ "$schema": "http:\/\/powerbi.com\/product\/schema#advanced", "filterType": 0, "target": { "column": "Overdue Wesentlichkeit", "table": "Overdue Wesentlichkeit" }, "conditions": [{ "operator": "GreaterThan", "value": 2000.0000000000 } ], "logicalOperator": "And" } ] } }
The output of the error event in the browser console looks like this:
With a breakpoint in the error event handler I can see that when the error is fired the constructor of the custom visual is not yet called.
Calling setSlicerState on the visual after report finished rendering no such error is thrown.
The error does not only occur with my custom visual but also e.g. with sample slicer from Microsoft (https://github.com/microsoft/powerbi-visuals-sampleslicer)
Thanks
Hello,
I see that column name and table name in the target object are the same. Is it correct?
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Hello,
yes, it is correct. The table name and column name are identical in this case. Changing from custom visual slicer to the standard slicer for this target the error does not occur and the standard slicer is showing the correct values set by the slicer filter from embed configuration and the report is filtered correctly.
Removing the slicer completely so that no visual matches the target error message "slicerTargetDoesNotMatch" also appears. So I think this the type of error is thrown in the case where no visual in a report matches the target.
So I think that the part (probably server side) of power bi which applies slicer filters from embed configuration to the report does not take the custom visual slicer into account. Perhaps because the type of the custom visual slicer is not "slicer" as by the standard slicer but the class name of this custom visual.
Maybe it is a limitation of Power BI embedded at the moment that custom visual slicers are not considered having slicer filters preapplied on report load.
Best regards
Hello,
Well, thanks alot for the investigation. I will transfer this info to a team that is responsible for Embeded API and we will try to find a solution or an answer and then I will share it here.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Hello again,
Btw, have you tried to apply a filter using an other way like in this topic and this documentation?
We should check this variant before asking for assistance of embedded team because it looks like your config is just incorrect.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Hello,
I did what you suggested and i moved the slicer filter targeting the custom visual slicer to the filter array of embed config. The error does not occur and the report is filtered accordingly.
This is the embed config copied from browser console (some properties are replaced by three dots):
{ "type": "report", "tokenType": 1, "embedUrl": "https://app.powerbi.com/reportEmbed?reportId=...", "permissions": 0, "viewMode": 0, "id": "...", "accessToken": "...", "slicers": [ { "selector": { "__type": "Selector_slicerTargetSelector:#cca", "$schema": "http://powerbi.com/product/schema#slicerTargetSelector", "target": { "column": "Date", "table": "Zeit" } }, "state": { "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Date", "table": "Zeit" }, "conditions": [ { "operator": "LessThan", "value": "2019-05-01T00:00:00" } ], "logicalOperator": "And" } ] } }, { "selector": { "__type": "Selector_slicerTargetSelector:#cca", "$schema": "http://powerbi.com/product/schema#slicerTargetSelector", "target": { "column": "Overduegrenze (Prozent)", "table": "Overduegrenze (Prozent)" } }, "state": { "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Overduegrenze (Prozent)", "table": "Overduegrenze (Prozent)" }, "conditions": [ { "operator": "GreaterThan", "value": 150 } ], "logicalOperator": "And" } ] } }, { "selector": { "__type": "Selector_slicerTargetSelector:#cca", "$schema": "http://powerbi.com/product/schema#slicerTargetSelector", "target": { "column": "Overduegrenze (Tage)", "table": "Overduegrenze (Tage)" } }, "state": { "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Overduegrenze (Tage)", "table": "Overduegrenze (Tage)" }, "conditions": [ { "operator": "GreaterThan", "value": 5 } ], "logicalOperator": "And" } ] } } ], "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Overdue Wesentlichkeit", "table": "Overdue Wesentlichkeit" }, "conditions": [ { "operator": "GreaterThan", "value": 2000 } ], "logicalOperator": "And" } ], "settings": { "background": 1, "filterPaneEnabled": false, "navContentPaneEnabled": false, "layoutType": 1, "extensions": [ { "command": { "name": "export", "title": "command export", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAjdJREFUOE+lUG1PUnEc9TP0Ydq0NKVZ9sjESQIBAl4MlQgoQETHg6QiKIo8LXRBLtfKtTYpEVBQpwES6nTqF+hVzV64tV7o6e9tV03vm9aL87v7n52H3VMG4L/AStpLpi1r8Rm68/oj8+qTGTYNgwuEvWS8ZC+aMLUXQWw3BMOy+tt5zVmwkpac7iC2G0Rw0wNdRjXPpmFAH8d6J2xfDOgpPEVXTgvTiuYouhPE+LYPj1PUj7ZZ+ffWuHRf8UG0zxpgJebXey8wuRtGbCeE6E4AE9t+RLZ8CG0Mw7/uxljJBcn0AyJnCegu6PGKmI9b+wqdMC6poF+koM22kG8rtBklCRiE8E0DkbMEkKVhXFbDmbPQrbosBU1Gjo55KVRpMZRJIbylfqjjSvCid3F/vA63w7XEem5ETVqJ8KYX6oVmtKUleJQSoSUpgGyOD80ChcE1BwbydvTnrbgRqLkY0J5QILDhgSr1p1Ux14TmRCPEn3hoT8uJ0Qbn5x70EnBGq04DyNIgS8Oc0cFH/rUl2US3SmcbIPpYD0Gciz7SKn/3ELVj1b84I5W4NlRxGnBs9hPjKFlal1VhqPgc7rVeuAoOulWZFNOtxEybzoI+1IwEI2QkWYIPT9GJjjhFj8WduAXFtBiOVQtsK12o8V4lcpYA2XvhSetA3kGbGcHNAIeYzbAsGVDpKT/hGdBH/JYPwRQPjZNc1L+8g3uRup+M4Ppo1WH18JXDSnf5QYXr8leGZ/DX49+Bst9hj8Z3qIsn5QAAAABJRU5ErkJggg==", "extend": { "visualContextMenu": { "title": "Ergebnisexport" }, "visualOptionsMenu": { "title": "Ergebnisexport" } } } } ], "localeSettings": { "formatLocale": "de-DE", "language": "en-US" } } }
Now this is the embed config where the error occurs:
{ "type": "report", "tokenType": 1, "embedUrl": "https://app.powerbi.com/reportEmbed?reportId=...", "permissions": 0, "viewMode": 0, "id": "...", "accessToken": "...", "slicers": [ { "selector": { "__type": "Selector_slicerTargetSelector:#cca", "$schema": "http://powerbi.com/product/schema#slicerTargetSelector", "target": { "column": "Date", "table": "Zeit" } }, "state": { "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Date", "table": "Zeit" }, "conditions": [ { "operator": "LessThan", "value": "2019-05-01T00:00:00" } ], "logicalOperator": "And" } ] } }, { "selector": { "__type": "Selector_slicerTargetSelector:#cca", "$schema": "http://powerbi.com/product/schema#slicerTargetSelector", "target": { "column": "Overduegrenze (Prozent)", "table": "Overduegrenze (Prozent)" } }, "state": { "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Overduegrenze (Prozent)", "table": "Overduegrenze (Prozent)" }, "conditions": [ { "operator": "GreaterThan", "value": 150 } ], "logicalOperator": "And" } ] } }, { "selector": { "__type": "Selector_slicerTargetSelector:#cca", "$schema": "http://powerbi.com/product/schema#slicerTargetSelector", "target": { "column": "Overduegrenze (Tage)", "table": "Overduegrenze (Tage)" } }, "state": { "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Overduegrenze (Tage)", "table": "Overduegrenze (Tage)" }, "conditions": [ { "operator": "GreaterThan", "value": 5 } ], "logicalOperator": "And" } ] } }, { "selector": { "__type": "Selector_slicerTargetSelector:#cca", "$schema": "http://powerbi.com/product/schema#slicerTargetSelector", "target": { "column": "Overdue Wesentlichkeit", "table": "Overdue Wesentlichkeit" } }, "state": { "filters": [ { "__type": "FilterAdvanced:#cca", "$schema": "http://powerbi.com/product/schema#advanced", "filterType": 0, "target": { "column": "Overdue Wesentlichkeit", "table": "Overdue Wesentlichkeit" }, "conditions": [ { "operator": "GreaterThan", "value": 2000 } ], "logicalOperator": "And" } ] } } ], "filters": [], "settings": { "background": 1, "filterPaneEnabled": false, "navContentPaneEnabled": false, "layoutType": 1, "extensions": [ { "command": { "name": "export", "title": "command export", "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAjdJREFUOE+lUG1PUnEc9TP0Ydq0NKVZ9sjESQIBAl4MlQgoQETHg6QiKIo8LXRBLtfKtTYpEVBQpwES6nTqF+hVzV64tV7o6e9tV03vm9aL87v7n52H3VMG4L/AStpLpi1r8Rm68/oj8+qTGTYNgwuEvWS8ZC+aMLUXQWw3BMOy+tt5zVmwkpac7iC2G0Rw0wNdRjXPpmFAH8d6J2xfDOgpPEVXTgvTiuYouhPE+LYPj1PUj7ZZ+ffWuHRf8UG0zxpgJebXey8wuRtGbCeE6E4AE9t+RLZ8CG0Mw7/uxljJBcn0AyJnCegu6PGKmI9b+wqdMC6poF+koM22kG8rtBklCRiE8E0DkbMEkKVhXFbDmbPQrbosBU1Gjo55KVRpMZRJIbylfqjjSvCid3F/vA63w7XEem5ETVqJ8KYX6oVmtKUleJQSoSUpgGyOD80ChcE1BwbydvTnrbgRqLkY0J5QILDhgSr1p1Ux14TmRCPEn3hoT8uJ0Qbn5x70EnBGq04DyNIgS8Oc0cFH/rUl2US3SmcbIPpYD0Gciz7SKn/3ELVj1b84I5W4NlRxGnBs9hPjKFlal1VhqPgc7rVeuAoOulWZFNOtxEybzoI+1IwEI2QkWYIPT9GJjjhFj8WduAXFtBiOVQtsK12o8V4lcpYA2XvhSetA3kGbGcHNAIeYzbAsGVDpKT/hGdBH/JYPwRQPjZNc1L+8g3uRup+M4Ppo1WH18JXDSnf5QYXr8leGZ/DX49+Bst9hj8Z3qIsn5QAAAABJRU5ErkJggg==", "extend": { "visualContextMenu": { "title": "Ergebnisexport" }, "visualOptionsMenu": { "title": "Ergebnisexport" } } } } ], "localeSettings": { "formatLocale": "de-DE", "language": "en-US" } } }
Best regards
Hello,
Do I correctly understand that this solution is sutable and your issue is solved or you still need my assitance?
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Hello,
this solution is not suitable because the filter pane is set to hidden in the embed config. So the user who opens the report has no other possibility to change the filter.
I to want use the second embed config as posted in my last reply to filter the report with slicers.
Many thanks for your effort
and best regards
Hello,
Well, I suppose we should ask advice from embedded API team.
Could you please send full descriptions with examples and pictures to pbicvsupport@microsoft.com ?
I will transfer the question to them and will provide the info here when they answer.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
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 |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 |