cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
shikhavidyarthi
Frequent Visitor

How to use slicer with conditions

I have a slicer with few items in it like A,B,C,D_Total,D, E,F,G. I have multi-selection option. However, I want to add a condition here. Whenever I select D and D_Total together, D should be disabled automatically and only D_Total should reflect the rest data in tab.

 

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

Hi @shikhavidyarthi ,

 

I suggest you to create an unrelated Dimitems table for slicer.

Measure:

Filter = 
VAR _VALUES =
    VALUES ( DimItems[Items] )
VAR _VALUESINCONDITION1 =
    FILTER ( _VALUES, [Items] <> "D" )
RETURN
    IF (
        ISFILTERED ( DimItems[Items] ),
        IF (
            AND ( "D" IN _VALUES, "D_Total" IN _VALUES ),
            IF ( MAX ( 'Table'[Items] ) IN _VALUES && MAX ( 'Table'[Items] ) <> "D", 1, 0 ),
            IF ( MAX ( 'Table'[Items] ) IN _VALUES, 1, 0 )
        ),
        1)

Add this measure into visual level filter and set it to show items when value = 1.

Result is as below.

vrzhoumsft_0-1691463820434.png

 

Best Regards,
Rico Zhou

 

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

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @shikhavidyarthi ,

 

I suggest you to create an unrelated Dimitems table for slicer.

Measure:

Filter = 
VAR _VALUES =
    VALUES ( DimItems[Items] )
VAR _VALUESINCONDITION1 =
    FILTER ( _VALUES, [Items] <> "D" )
RETURN
    IF (
        ISFILTERED ( DimItems[Items] ),
        IF (
            AND ( "D" IN _VALUES, "D_Total" IN _VALUES ),
            IF ( MAX ( 'Table'[Items] ) IN _VALUES && MAX ( 'Table'[Items] ) <> "D", 1, 0 ),
            IF ( MAX ( 'Table'[Items] ) IN _VALUES, 1, 0 )
        ),
        1)

Add this measure into visual level filter and set it to show items when value = 1.

Result is as below.

vrzhoumsft_0-1691463820434.png

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors