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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
FrançoisD
Frequent Visitor

I can't get the "single selection required" real value of a slicer with the client API

Hello,

 

I have a report with a categorical slicer. This slicer has "single select" checked and renders as a "one selection" visual:

 

FranoisD_0-1718781081297.pngFranoisD_1-1718781093662.png

 

However, when I use the client API in embed mode, when I get this slicer and then run `const state = await slicer.getState()`

the `state.filters[0].requireSingleSelection` is always set to false whatever the check status on my report.

Is it a known issue or is it because I get the wrong attribute?

 

2 REPLIES 2
Anonymous
Not applicable

Hi @FrançoisD ,

Please review the following links, hope they can help get the expected result...

Get slicer state

Slicers · microsoft/PowerBI-JavaScript Wiki · GitHub

let state = await visual.getSlicerState();
// Get the list of visuals from the report
report.getPages()
    .then(function(pages) {
        return pages[0].getVisuals();
    })
    .then(function(visuals) {
        // Find the slicer visual by name or other properties
        let slicer = visuals.find(function(visual) {
            return visual.type === 'slicer' && visual.name === 'SlicerVisualName';
        });

        // Get the state of the slicer
        return slicer.getSlicerState();
    })
    .then(function(slicerState) {
        // Access the selected value
        let selectedValue = slicerState.targets[0].target;
        console.log('Selected Value:', selectedValue);
    })
    .catch(function(errors) {
        console.error(errors);
    });

Best Regards

Hello,

Thanks for your reply but, it does not answer my question at all.

I am already using the getSlicerState function and I can already get the selected value and even set it.

My issue is that I cannot programmatically make the difference between a slicer that only accept one selected value and a slicer that accept many because the "requireSingleSelection" boolean is always set to "false" in the state.filters attribute.

Regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Kudoed Authors