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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Carrhill
Helper I
Helper I

How to look at two columns with CONTAINS STRING

Hello, 

 

I need to add two conditions to a CONTAINS STRING statement but it's not working.  I'd appreciate if somebody can help please

 

It would look something like this 

 

Column = IF( CONTAINSSTRING(('Table '[Column] "A" && CONTAINSSTRING ('Table'[Column] "B") "Y", "Z" ))
 
Thank you!!
1 ACCEPTED SOLUTION

Hi @Carrhill ,

 

Try this instead:

Output = 
VAR _FindString01 = SEARCH("ABC", [Column1], 1, 0)
VAR _FindString02 = SEARCH("XYZ", [Column2], 1, 0)

RETURN IF(_FindString01 > 0 && _FindString02 > 0, "X", "Y")

 

Example Output:

hnguy71_0-1651095551727.png

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Carrhill , Try like

 

Column = IF( CONTAINSSTRING('Table '[Column] "A") || CONTAINSSTRING ('Table'[Column] "B") || CONTAINSSTRING ('Table'[Column] "Y")|| CONTAINSSTRING ('Table'[Column] "Z") )

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

Hey @amitchandak ,

 

Thank you!  You have solved the problem posed.   However I wasn't entirely clear in my question.

This is my goal...

If the column 1 contains "abc", and Column 2 contains "xyz", return X, else Y 

 

Is there a way to do this ?  Thanks for your help!

Hi @Carrhill ,

 

Try this instead:

Output = 
VAR _FindString01 = SEARCH("ABC", [Column1], 1, 0)
VAR _FindString02 = SEARCH("XYZ", [Column2], 1, 0)

RETURN IF(_FindString01 > 0 && _FindString02 > 0, "X", "Y")

 

Example Output:

hnguy71_0-1651095551727.png

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.