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

View all the Fabric Data Days sessions on demand. View schedule

Reply
lherbert501
Post Partisan
Post Partisan

Slicer & Categories Query

Hi,

 

If I had simple layout like in the image below, and I highlighted all four slicer options then I would like to only see items that have all four categories attached. In the example if I select all slicer options then this will show me item 1, as it technically is correct with it covering 3 categories that are selected.

 

How can I go about only returning in the table items that had all four categories?

 

Thanks

 

lherbert501_0-1686665966704.png

 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @lherbert501 ,

According to your description, here's my solution. 

1.Don't make relationship between the two tables.

vyanjiangmsft_0-1686814604862.png

2.Create a measure:

Measure =
IF (
    ISFILTERED ( Category[Category] ),
    IF (
        COUNTROWS (
            FILTER (
                DISTINCT ( Category[Category] ),
                'Category'[Category]
                    IN SELECTCOLUMNS (
                        FILTER ( ALL ( 'Table' ), 'Table'[Item] = MAX ( 'Table'[Item] ) ),
                        "category", 'Table'[Category]
                    )
            )
        )
            >= COUNTROWS ( DISTINCT ( 'Category'[Category] ) ),
        1,
        0
    ),
    1
)

Put the measure in the visual level filter and select "is 1", get the correct result:

vyanjiangmsft_1-1686814717947.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @lherbert501 ,

According to your description, here's my solution. 

1.Don't make relationship between the two tables.

vyanjiangmsft_0-1686814604862.png

2.Create a measure:

Measure =
IF (
    ISFILTERED ( Category[Category] ),
    IF (
        COUNTROWS (
            FILTER (
                DISTINCT ( Category[Category] ),
                'Category'[Category]
                    IN SELECTCOLUMNS (
                        FILTER ( ALL ( 'Table' ), 'Table'[Item] = MAX ( 'Table'[Item] ) ),
                        "category", 'Table'[Category]
                    )
            )
        )
            >= COUNTROWS ( DISTINCT ( 'Category'[Category] ) ),
        1,
        0
    ),
    1
)

Put the measure in the visual level filter and select "is 1", get the correct result:

vyanjiangmsft_1-1686814717947.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

This is great - Thankyou @v-yanjiang-msft  for your time with it.

 

Seems uneccesary code instead of having an OR or AND switch on a slicer though!

 

Thanks again

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors