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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
zahin_maisa
Helper I
Helper I

Use slicer as selector - show no selections when no slicer option active

zahin_maisa_0-1746518932906.png

zahin_maisa_2-1746519412472.png

I want to use a slicer as a selector, displaying no selections when no slicer option is checked, and all when select all is checked.

I use the following measure to count no. of selections:

SelectedOptionCount =
VAR SelectedOptions = COUNTROWS (ALLSELECTED (...))
VAR TotalOptions = COUNTROWS (ALL((...)))
RETURN
IF (SelectedOptions = TotalOptions||ISBLANK(SelectedOptions), 0, SelectedOptions)

The card on the right has field SalesOption. The filter, SelectOptionCount > 0, on it ensures no selections show when the slicer is inactive. However, SelectOptionCount is 0 when I select all with my current measure: 

zahin_maisa_1-1746519372523.png

 

1 ACCEPTED SOLUTION

Hi @zahin_maisa,

 

Please try this below approach:

Create a disconnected table and use this in the slicer instead of the original one i.e 'Sales'[SalesOption]. Now use this below measure to detect the slicer status:

 

SelectedOptionStatus =

VAR TotalOptions = COUNTROWS(ALL('SalesOptions_Disconnected'))

VAR SelectedOptions = COUNTROWS(VALUES('SalesOptions_Disconnected'))

RETURN

SWITCH(

    TRUE(),

    SelectedOptions = 0, "Nothing Selected",

    SelectedOptions = TotalOptions, "All Selected",

    SelectedOptions < TotalOptions, "Filtered Selection",

    "Other"

)

 

This avoids interaction from other slicers or pages and gives the expected output.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

View solution in original post

8 REPLIES 8
johnt75
Super User
Super User

Try

IF ( (SelectedOptions = TotalOptions && NOT ISFILTERED(...) ) ||ISBLANK(SelectedOptions), 0, SelectedOptions)

zahin_maisa_0-1746699477881.pngzahin_maisa_2-1746699523730.png

The measure displays as 0 in the card, but the filter >0 doesn't work for some reason

Hi @zahin_maisa,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Try this below measure:

SelectedOptionCount =
VAR SelectedOptions = COUNTROWS(VALUES('Sales'[SalesOption]))
VAR TotalOptions = COUNTROWS(ALL('Sales'[SalesOption]))
RETURN
SWITCH(
TRUE(),
SelectedOptions = 0, BLANK(), 
SelectedOptions = TotalOptions && NOT HASONEFILTER('Sales'[SalesOption]), BLANK(), 
SelectedOptions 
)

 

This will Return BLANK() when nothing is selected or when Select All is selected but no real filter is applied. Return count when actual filtering is done.

Apply a visual level filter SelectedOptionCount is not blank. This ensures the visual appears only when the user actively selects options.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

I want to distiguish between 'Select all' and select nothing. This formula is more complicated but results in this: 

zahin_maisa_0-1747217401994.png

 

Hi @zahin_maisa,

 

Here is the updated measure, it will distinguish all the cases:

 

SelectedOptionStatus =

VAR SelectedCount = COUNTROWS(VALUES('Sales'[SalesOption]))

VAR TotalCount = COUNTROWS(ALL('Sales'[SalesOption]))

RETURN

SWITCH(

    TRUE(),

    SelectedCount = 0, "Nothing Selected",

    SelectedCount = TotalCount && NOT ISFILTERED('Sales'[SalesOption]), "All Selected (No Filter)",

    SelectedCount = TotalCount, "All Selected (Manual)",

    "Filtered Selection"

)

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

It always returns 'Filtered Selection'. I believe that because this slicer is affected by another in a previous page. Is there a workaround?

Hi @zahin_maisa,

 

Please try this below approach:

Create a disconnected table and use this in the slicer instead of the original one i.e 'Sales'[SalesOption]. Now use this below measure to detect the slicer status:

 

SelectedOptionStatus =

VAR TotalOptions = COUNTROWS(ALL('SalesOptions_Disconnected'))

VAR SelectedOptions = COUNTROWS(VALUES('SalesOptions_Disconnected'))

RETURN

SWITCH(

    TRUE(),

    SelectedOptions = 0, "Nothing Selected",

    SelectedOptions = TotalOptions, "All Selected",

    SelectedOptions < TotalOptions, "Filtered Selection",

    "Other"

)

 

This avoids interaction from other slicers or pages and gives the expected output.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

bhanu_gautam
Super User
Super User

@zahin_maisa , Try using

DAX
SelectedOptionCount =
VAR SelectedOptions = COUNTROWS (ALLSELECTED (...))
VAR TotalOptions = COUNTROWS (ALL((...)))
RETURN
IF (SelectedOptions = TotalOptions, TotalOptions, IF(ISBLANK(SelectedOptions), 0, SelectedOptions))




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.