Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Neehar
Helper I
Helper I

How to retrieve Slicers Data prom power BI report

Hello,

 

I want to retrieve the Slicers data in a power bi report from all the pages.

 

I tried the below code, which is provided in the url getSlicers()

 

page.getSlicers()
        .then(slicers => {
            debugger
            console.log(slicers);
        });

 I thrown an error Uncaught (in promise) TypeError: page.getSlicers is not a function.

 

Please help me with a working example.

 

Thank You

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Neehar,

I'd like to suggest you test on the power bi playground, it shared the sample report and corresponding code snaps of each operation:

Power BI Playground - Developer Sandbox

// Retrieve the page collection and get the slicers for the active page.
try {
    const pages = await report.getPages();

    // Retrieve the active page.
    let pageWithSlicer = pages.filter(function (page) {
        return page.isActive;
    })[0];

    const visuals = await pageWithSlicer.getVisuals();

    // Retrieve all visuals with the type "slicer".
    let slicers = visuals.filter(function (visual) {
        return visual.type === "slicer";
    });

    slicers.forEach(async (slicer) => {
        // Get the slicer state.
        const state = await slicer.getSlicerState();
        console.log("Slicer name: \"" + slicer.name + "\"\nSlicer state:\n", state);
    });
}
catch (errors) {
    console.log(errors);
}

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @Neehar,

I'd like to suggest you test on the power bi playground, it shared the sample report and corresponding code snaps of each operation:

Power BI Playground - Developer Sandbox

// Retrieve the page collection and get the slicers for the active page.
try {
    const pages = await report.getPages();

    // Retrieve the active page.
    let pageWithSlicer = pages.filter(function (page) {
        return page.isActive;
    })[0];

    const visuals = await pageWithSlicer.getVisuals();

    // Retrieve all visuals with the type "slicer".
    let slicers = visuals.filter(function (visual) {
        return visual.type === "slicer";
    });

    slicers.forEach(async (slicer) => {
        // Get the slicer state.
        const state = await slicer.getSlicerState();
        console.log("Slicer name: \"" + slicer.name + "\"\nSlicer state:\n", state);
    });
}
catch (errors) {
    console.log(errors);
}

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.