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
Bian
Helper II
Helper II

Slice table with AND instead of OR

Simple question but can't get my head around the solution.

 

1 Product Table

1 Customer Table

1 CustomerProduct Table

 

I have a slicer on Product and shows a table on the customers. I wan't to be able to select 2 (or more) products in the slicer and only show the customers that has all selected products.

 

Could you please point me in the right direction?

 

/Bian

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

HI @Bian,

 

Slicer not support to change its filter logic. In my opinion, I'd like to suggest you create new table as source of slicer, then write a measure to compare selected value and table value and return result tag.

 

After these steps, you can drag above measure to visuals' 'visual level filter' to achieve 'and' filter effect.(notice: selector table not have relationship to original table)

 

Sample formula:

Select Tag =
VAR _selected =
    ALLSELECTED ( Selector[Item] )
VAR _current =
    CALCULATETABLE ( VALUES ( 'Sample'[Item] ), VALUES ( 'Sample'[Type] ) )
RETURN
    IF (
        CONCATENATEX ( INTERSECT ( _current, _selected ), [Item], "," )
            = CONCATENATEX ( _selected, [Item], "," ),
        "Y",
        "N"
    )

Result:

1.gif

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @Bian,

 

Slicer not support to change its filter logic. In my opinion, I'd like to suggest you create new table as source of slicer, then write a measure to compare selected value and table value and return result tag.

 

After these steps, you can drag above measure to visuals' 'visual level filter' to achieve 'and' filter effect.(notice: selector table not have relationship to original table)

 

Sample formula:

Select Tag =
VAR _selected =
    ALLSELECTED ( Selector[Item] )
VAR _current =
    CALCULATETABLE ( VALUES ( 'Sample'[Item] ), VALUES ( 'Sample'[Type] ) )
RETURN
    IF (
        CONCATENATEX ( INTERSECT ( _current, _selected ), [Item], "," )
            = CONCATENATEX ( _selected, [Item], "," ),
        "Y",
        "N"
    )

Result:

1.gif

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you very much for this. Will try to implement it and get back to you.

Works perfectly! Thank you very much.

 

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.