Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I’m embedding a Power BI report in a web application, and I am generally able to use Javascript to read the user-selected values in the report’s slicers.
In Javascript, I am simply calling
state = await slicer.getSlicerState();
This works for most slicers, but one of our slicers allows the user to choose one or more values from a hierarchical tree (screenshots below). This sometimes works and sometimes does not, depending on what the user chooses. Scenarios 1 and 2 below work, but Scenario 3 throws an error (details below).
The error message I’m getting back makes this sound like a bug rather than simply an omitted feature. Is this a bug that will be fixed? Is there a workaround?
1.
If the user selects a single checkbox at the parent level, I can use Javascript to get the following slicer state filter. Everything is good.
{"$schema":"http://powerbi.com/product/schema#basic","target":{"table":"clm Locations","column":"Level"},"filterType":1,"operator":"In","values":["3"],"requireSingleSelection":false}
2.
If the user selects a single checkbox at the child level, I can use Javascript to get the following slicer state filter. Everything is good.
{"$schema":"http://powerbi.com/product/schema#tuple","target":[{"table":"clm Locations","column":"Level"},{"table":"clm Locations","column":"LocationName"}],"filterType":6,"operator":"In","values":[[{"value":"3"},{"value":"CEMETERY-341"}]]}
3.
If the user selects all but one or two values at the child level, calling Javascript to get the slicer state throws an exception.
Exception thrown is as follows:
{message: 'slicerSerializationFailed', detailedMessage: 'Failed to serialize slicer filters to json object', level: 3}
Although this answer does help, I am not sure that the documentation says that this functionality is not supported. On the contrary, it says that hierarchy slicers are supported, yet this is not working. Is there a place where I can report this as a bug to be fixed?
Hi @GregBoet ,
Base on your description, it seems like you got the error when chose one or multiple values at the child level. Please check if hit any following limitation:
Use slicers when embedding a report in Power BI embedded analytics | Microsoft Learn
Best Regards
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
37 | |
4 | |
3 | |
2 | |
2 |