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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AlexisOlson
Super User
Super User

How to distinguish between all selected and none selected for a slicer

Suppose I have two tables. One data table and one table with values I potentially want to filter out.

 

Table1   Exclude

ID          ID

1            2

2            5

3

4

5

6

 

I put Exclude[ID] as a slicer and write a measure to read the slicer and determine if Table1[ID] is to be excluded.

 

 

Excluded = IF(MAX(Table1[ID]) IN VALUES('Exclude'[ID]), 1, 0)

 

This mostly works but returns 1 for every ID in Exclude if no slicer has been selected.

 

Exclude1.png

 

To fix this I added and ISFILTERED condition to my measure.

 

 

Excluded = IF(ISFILTERED('Exclude'[ID]) && MAX(Table1[ID]) IN VALUES('Exclude'[ID]), 1, 0)

 

Seems to work. The above scenario now returns all zeros as I'd expect it to. However, now I have a problem when selecting all. Starting from nothing selected, if I click 2 and then 5 on the slicer, then I get this (which I'd expect):

 

Exclude2.png

 

Weirdly, if instead of selecting the boxes individually, I use the Select All button to select both 2 and 5, then I get all zeros, behaving exactly like I have nothing selected.

 

Exclude3.png

 

The measure has not changed and the slicer looks identical, but I'm getting different results.

 

How can I make these both give the same result (the former not the latter)? Is this a bug where Power BI doesn't differentiate between all selected and none selected for some reason?

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @AlexisOlson

 

Interesting observation

 

Seemingly "SelectAll" button is just the  "clear all selections" button placed inside a Slicer with other items.

 

So the visual appearance of the slicer should be same when "SelectAll" and "clear all selections" button is pressed

So the SelectAll button should remove the ticks from the Slicer Items just like when we press clear all selections.

 

howtod.png


Regards
Zubair

Please try my custom visuals

Yes you are right. I overlooked this practical use of ticks.

 

But technically (for Dax purposes) the SelectALL button means there is no direct filter on the same column [(ISFILTERED(ID) is FALSE)] which is the same as clear all SELECTIONS.

 

I also have this feeling that it would be more valuable for SELECTALL option to be treated as selection of all items rather than absence of filter

 

I think a Microsoft Employee will get back to you on this

 

 

 


Regards
Zubair

Please try my custom visuals

I'm not sure I agree. Select All is quite useful when I want to do all-except filtering. I click Select All and deselect the few I don't want to see rather than manually selecting every other option. If it were equivalent to Clear selections, then you couldn't do this.

I dont think you got zubair's point. The exclude all functionality can be acheived still in zubair's case if you press cntrl button. but there is no way to distinguish between isfiltered and select all. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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