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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
JagadishNallami
Frequent Visitor

getSlicerState returning the not selected items instead of selected items

Hi there,

 

I am having a slicer with hierachial data. When I tried to get the state of the slicer, I am getting the "Not selected" information instead of selected information like below. As it is a hierarchial data, I am having a tough time getting the selected data by filtering.

 

JagadishNallami_0-1723015403301.png

 

can anyone help me if there is a way to fetch the selected instead of NotSelected?

 

It helps a lot. Thank you in advance!!

 

 

1 REPLY 1
Anonymous
Not applicable

Hi @JagadishNallami ,

Base on your description, it seems like you are trying to get the selected values of hierarchies data in a slicer when using "getSlicerState" in Power BI. Please try the below codes:

Use slicers in Power BI embedded analytics | Microsoft Learn

// First, get the slicer state
slicer.getSlicerState().then(slicerState => {
	// slicerState.values contains the state information
	const selectedValues = slicerState.filters
		.filter(filter => filter.isNotSelected === false) // Filter out the "NotSelected" items
		.map(filter => filter.value); // Extract the selected values

	console.log("Selected Values: ", selectedValues);
}).catch(error => {
	console.error("Error fetching slicer state: ", error);
});

Best Regards

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors