Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello All,
We are currently trying to implement functionality where we save the state of all slicers on a report so that when a user comes back to the report in the future, it re-renders in the state that the user left the report in.
We are however experiencing an issues whereby getSlicerState seems to error if retrieving slicerstates from any other page other than the active one.
See example below:-
const pages = await report.getPages();
for (const page of pages) {
let theSlicers;
let allOfTheVisuals;
await page
.getVisuals()
.then((visuals) => {
allOfTheVisuals = visuals;
})
.catch((err) => {
console.log(`error getting the page visuals:`, err);
});
// Separate out the slicers from the visuals
theSlicers = allOfTheVisuals.filter((visual) => {
return visual.type == "slicer";
});
const slicerFilterData = [];
for (const slicer of theSlicers) {
await slicer
.getSlicerState()
.then((filters) => {
// If there are no filters then don't add the slicer.
if (filters === undefined || filters.length === 0) return;
const obj: VisualLevelFilter = {
name: slicer.name,
type: slicer.type,
filters: filters,
};
slicerFilterData.push(obj); //Does not populate this when slicers are not on active page
})
.catch(
(err) => {
throw(err); //Errors here
}
);
}
}
Has anyone encountered this problem before, or does anyone have a workaround for this?
Much Appreciated
Graham
@Nojustice I have just come across the same issue. Have you found a workaround or been able to solve this?
Sorry I forgot to add the error
{"message":"visualConfigIsNotInitialized","detailedMessage":"Visual container config is not initialized"}
Hi @Nojustice,
According to your error message, it seems like your request did not include the configs so that it failed to initialize.
If that is the case, I'd like to suggest you take a look following links about power bi javascript and correspond configurations.
Embed Configuration Details
Regards,
Xiaoxin Sheng
@Anonymous
I have only provided an example piece of code, at the point this is executed the report is already rendered on the screen so all the configuration has already been passed to it.
As an example the report contains 2 tabs,
Tab1 = Books
Tab2 = Authors
The user alters some slicers on Books, then moves to Authors and alters some slicers.
The user hits save (code in my original post is executed)
It seems to only getslicerstate from the slicers on the current page (in this case Authors), I want to store what the slicerstate is from Books page.
Hope this brings some more clarity
Hi @Nojustice,
So you mean you want to add data processing methods into the requests? Did this error disappear if you remove these operations?
If that is the case, it may mean power bi not allow you to do some additional operation to send/access to the external resources.
Regards,
Xiaoxin Sheng
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |