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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Using Search with variable using multiple strings in disconnected slicers

I have a slicer which contains a list of text fields which are available in a column of the main dataset. I have used the SEARCH function in DAX to pick up all the values from the main dataset which contains the selected text(somewhat like the "LIKE" function in SQL). It works fine, when I select a single value, however, when multiple values are selected, it starts throwing an error. What I want, is like in SQL, when 2 or more values are selected from the slicer, it UNIONS the values. Below are the screenshots for reference and the DAX used.

 

Here, the Tool Name slicer is used to filter data from the In_Scope_And_Additional_Tools column using the created measure Exists.

 

DAX for "Exists" is : 

Exists = IF(SELECTEDVALUE(Query1[ToolName]) <> " ALL",
SEARCH(SELECTEDVALUE(Query1[ToolName]),SELECTEDVALUE(SF_Opportunity[In_Scope_AND_Additional_Tools]),1,-1),1)

This works well when only 1 value is selected, However, because SELECTEDVALUE function only allows 1 selection, it doesn't allows us to select 2 or more than 2. Is there a workaround for this?

 

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Try this measure to search each item in the slicer selection and return "Exist" if found else blank.

Exists = 
VAR _SELECTED = ALLSELECTED(Query1[ToolName])

RETURN
IF( 
    ISFILTERED(Query1[ToolName]),

    IF( 
        ISBLANK(
            COUNTX(
                _SELECTED,
                SEARCH(Query1[ToolName],SELECTEDVALUE(SF_Opportunity[In_Scope_AND_Additional_Tools]),1,BLANK())
            )
        ),
        BLANK(),
        "Exist"
    ),
    BLANK()
)

  

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@Anonymous 

Try this measure to search each item in the slicer selection and return "Exist" if found else blank.

Exists = 
VAR _SELECTED = ALLSELECTED(Query1[ToolName])

RETURN
IF( 
    ISFILTERED(Query1[ToolName]),

    IF( 
        ISBLANK(
            COUNTX(
                _SELECTED,
                SEARCH(Query1[ToolName],SELECTEDVALUE(SF_Opportunity[In_Scope_AND_Additional_Tools]),1,BLANK())
            )
        ),
        BLANK(),
        "Exist"
    ),
    BLANK()
)

  

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@Anonymous , see if this can help

https://docs.microsoft.com/en-us/dax/contains-function-dax

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak : How do we pass 2 or more values? SELECTEDVALUE is only allowing me to pass 1 value at a time.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.