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
rachaelwalker
Resolver III
Resolver III

Slicer for all data and partial data

I am looking for a solution that allows me to add a slicer/filter with custom text based on the data in a column. I have an employee type column with the following types:

 

Executive

Director

Employee

 

I want a slicer or filter that I can click "Include" to show all employee types and "Exclude" that I can click that shows only Employee (removes director and executives). 

 

I have tried creating a toggle action button using bookmarks but if I drill down in the visuals, then select my bookmark, what I have previously selected is reset.

 

I have tried a conditional column but the request is to have a filter that says Include or Exclude. My current slicer says Select All to get all of them to show. 

rachaelwalker_0-1654108159748.png

 

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

could you try to create a new table like this, call it e.g. Filters:

Filter
Include
Exclude

 

This table 

 

Next create a measure like this

 

Measures =
VAR _f =
    CALCULATE ( SELECTEDVALUE ( 'Filters'[Filter] ) )
RETURN
    IF (
        _f = "Include",
        1,
        IF (
            COUNTROWS (
                CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[EmployeeType] = "C" ) )
            ) >= 1,
            1,
            0
        )
    )

 


Add this measure to the filter pane of your visual, and set it to filter on equal to 1:

sturlaws_0-1654125534760.png

 

sturlaws_1-1654125665647.png

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

View solution in original post

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

could you try to create a new table like this, call it e.g. Filters:

Filter
Include
Exclude

 

This table 

 

Next create a measure like this

 

Measures =
VAR _f =
    CALCULATE ( SELECTEDVALUE ( 'Filters'[Filter] ) )
RETURN
    IF (
        _f = "Include",
        1,
        IF (
            COUNTROWS (
                CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[EmployeeType] = "C" ) )
            ) >= 1,
            1,
            0
        )
    )

 


Add this measure to the filter pane of your visual, and set it to filter on equal to 1:

sturlaws_0-1654125534760.png

 

sturlaws_1-1654125665647.png

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

 

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.