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
BrisbanePom
New Member

Return checked item(s) from a slicer as a measure when other slicers are interacting on the data

In an earlier question, I asked for a way to show the values selected in a slicer as a measure:
Solved: Return Selected Item(s) from a slicer in a measure - Microsoft Power BI Community
I wanted to show "All", "Item X" or "N Items selected" depending upon how many boxes were checked on the slicer.

The provided solution (from @AntrikshSharma) that I accepted worked in the case of a single slicer being selected: 

Measure = 
VAR SelectedMember = 
    COUNTROWS ( VALUES ( Staff_Details[Staff Member] ) )
VAR All_Members = 
    COUNTROWS ( ALL ( Staff_Details[Staff Member] ) )
VAR Result = 
    SWITCH ( 
        TRUE(),
        All_Members = SelectedMember, "All Selected",
        SelectedMember = 0, "No Member Selected",
        SelectedMember = 1, SELECTEDVALUE ( Staff_Details[Staff Member] ),
        SelectedMember > 1, SelectedMember & " Staff members Selected"
    )
RETURN Result

However, because I then applied other slicers to the data, this solution no longer works.   For example if a Slicer that selects another filter is applied - e.g. Store -  it results in the number of rows on the data being filtered so that SelectedMember != All_Members and therefore the Result showing N staff members selected.  What I want is that "All" to remain selected as no staff member has specifically being selected in the Slicer.

Whilst the above is technically valid because it is based on the data table, what I really want is something that reflects the value of the boxes selected in the slicer, irrespective of what happens to the underlying data.

 

Is there way to diretly interpret the slicer selection, or is a workaround required that relies on the underlying table?

2 REPLIES 2
tamerj1
Super User
Super User

Hi @BrisbanePom 
Create dimention tables and use the for the slicers.

FreemanZ
Super User
Super User

hi  @BrisbanePom

try like:

Measure =
VAR SelectedMember =
    COUNTROWS ( VALUES ( Staff_Details[Staff Member] ) )
VAR All_Members =
    COUNTROWS ( 
        CALCULATETABLE(
            ALL ( Staff_Details[Staff Member] ) ,
            ALL ( Staff_Details)       
        ) 
    )
VAR Result =
    SWITCH (
        TRUE(),
        All_Members = SelectedMember, "All Selected",
        SelectedMember = 0, "No Member Selected",
        SelectedMember = 1, SELECTEDVALUE ( Staff_Details[Staff Member] ),
        SelectedMember > 1, SelectedMember & " Staff members Selected"
    )
RETURN Result

 

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.