Forum Discussion
Error "slicerTargetDoesNotMatch" while embedded report with custom visual slicer loads
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
[email protected]
- FrankSindermann7 years agoFrequent Visitor
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
- v-evelk7 years agoMicrosoft Employee
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
[email protected]- v-evelk7 years agoMicrosoft Employee
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
[email protected]