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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Condensing multiple If SEARCH dax formula

Hi all,

 

Trying to condense down a formula where I need to search for multiple values in a column then output one of two outcomes, its working fine with many nested if(search( functions however I wanted to see if I could use double pipe operators to get it a bit tidier, is there a simple way to do so, the below code is giving me the error "cannot convert type text to true/false":

 

Formula =
IF(SEARCH("a"||"b"||"c"||"d"||"e",Table[col1],,0)>0,
"outcome1",
IF(SEARCH("f"||"g",Table[col1],,0)>0,
"outcome2",""))
 
thanks for any advice you can offer.
1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

You can try this measure:

Formula = 
SWITCH(
    TRUE(),
    NOT ISEMPTY(INTERSECT({"a","b","c","d","e"},VALUES('Table'[Column1]))), "Outcome1",
    NOT ISEMPTY(INTERSECT({"f","g"},VALUES('Table'[Column1]))), "Outcome2",
    "No Outcome"
) 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

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


Website 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

4 REPLIES 4
Fowmy
Super User
Super User

@Anonymous 

You can try this measure:

Formula = 
SWITCH(
    TRUE(),
    NOT ISEMPTY(INTERSECT({"a","b","c","d","e"},VALUES('Table'[Column1]))), "Outcome1",
    NOT ISEMPTY(INTERSECT({"f","g"},VALUES('Table'[Column1]))), "Outcome2",
    "No Outcome"
) 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

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


Website 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

Anonymous
Not applicable

That works great thanks.

@Anonymous 

 

Great, you can accept it as a solution as well. 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

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


Website 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

AlB
Community Champion
Community Champion

There'@JDro

Formula = 
SWITCH (
    TRUE (),
    COUNTROWS (
        FILTER ( { "a", "b", "c", "d", "e" }, SEARCH ( [Value], Table1[col1],, 0 ) > 0 )
    ) > 0, "outcome1",
    COUNTROWS ( FILTER ( { "f", "g" }, SEARCH ( [Value], Table1[col1],, 0 ) > 0 ) ) > 0, "outcome2",
    ""
)

Please mark the resolved question when you are finished and consider giving a thumbs up if the posts are useful.

Contact me privately for assistance with any large-scale BI needs, tutoring, etc.

Bless you

SU18_powerbi_badge

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