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
Anonymous
Not applicable

loop over multiple select slicer

Hi everyone 

Here is my problem. I have a table (LDM LIVE) with a summary,labels and description columns with a slicer (Part number) from another table (EPICOR LIVE). I need to find if the slicer value is found in the table summary. 

If just one selected value in the slicer is one I have no problems. I use the following dax measure and then filter with those who have a value of 1 

IsContained =
var _slicer= SELECTEDVALUE('EPICOR LIVE'[Part number])
var _currentRow=SELECTEDVALUE('LDM live'[Summary])
var _currentRow2=SELECTEDVALUE('LDM live'[Description])
var _currentRow3=SELECTEDVALUE('LDM live'[Labels])

RETURN
IF(FIND(_slicer,_currentRow,1, FIND(_slicer,_currentRow2,1,FIND(_slicer,_currentRow3,1,FALSE()))),1,0)

However if the slicer has multiple select values I couldn't find a way to do the same calculation. 
Can someone help please ?
2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

IsContained =
IF (
    NOT ISEMPTY (
        FILTER (
            'LDM live',
            NOT ISEMPTY (
                FILTER (
                    ALLSELECTED ( 'EPICOR LIVE'[Part number] ),
                    CONTAINSSTRING ( 'LDM live'[Summary], 'EPICOR LIVE'[Part number] )
                        || CONTAINSSTRING ( 'LDM live'[Description], 'EPICOR LIVE'[Part number] )
                        || CONTAINSSTRING ( 'LDM live'[Labels], 'EPICOR LIVE'[Part number] )
                )
            )
        )
    ),
    1
)

View solution in original post

@Anonymous 

Please try

IsContained =
IF (
    COUNTROWS ( ALLSELECTED ( 'EPICOR LIVE'[Part number] ) )
        <> COUNTROWS ( ALL ( 'EPICOR LIVE'[Part number] ) ),
    IF (
        NOT ISEMPTY (
            FILTER (
                'LDM live',
                NOT ISEMPTY (
                    FILTER (
                        ALLSELECTED ( 'EPICOR LIVE'[Part number] ),
                        CONTAINSSTRING ( 'LDM live'[Summary], 'EPICOR LIVE'[Part number] )
                            || CONTAINSSTRING ( 'LDM live'[Description], 'EPICOR LIVE'[Part number] )
                            || CONTAINSSTRING ( 'LDM live'[Labels], 'EPICOR LIVE'[Part number] )
                    )
                )
            )
        ),
        1
    )
)

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@tamerj1 What if I don't want the table to show anything if nothing is selected in the slicer ? 

@Anonymous 

Please try

IsContained =
IF (
    COUNTROWS ( ALLSELECTED ( 'EPICOR LIVE'[Part number] ) )
        <> COUNTROWS ( ALL ( 'EPICOR LIVE'[Part number] ) ),
    IF (
        NOT ISEMPTY (
            FILTER (
                'LDM live',
                NOT ISEMPTY (
                    FILTER (
                        ALLSELECTED ( 'EPICOR LIVE'[Part number] ),
                        CONTAINSSTRING ( 'LDM live'[Summary], 'EPICOR LIVE'[Part number] )
                            || CONTAINSSTRING ( 'LDM live'[Description], 'EPICOR LIVE'[Part number] )
                            || CONTAINSSTRING ( 'LDM live'[Labels], 'EPICOR LIVE'[Part number] )
                    )
                )
            )
        ),
        1
    )
)
Anonymous
Not applicable

@tamerj1 It worked perfect. Thank you

tamerj1
Super User
Super User

Hi @Anonymous 
Please try

IsContained =
IF (
    NOT ISEMPTY (
        FILTER (
            'LDM live',
            NOT ISEMPTY (
                FILTER (
                    ALLSELECTED ( 'EPICOR LIVE'[Part number] ),
                    CONTAINSSTRING ( 'LDM live'[Summary], 'EPICOR LIVE'[Part number] )
                        || CONTAINSSTRING ( 'LDM live'[Description], 'EPICOR LIVE'[Part number] )
                        || CONTAINSSTRING ( 'LDM live'[Labels], 'EPICOR LIVE'[Part number] )
                )
            )
        )
    ),
    1
)

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.