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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
e2liu77
Helper I
Helper I

Search a string in other column in same row

Hi,

I would like to compare 2 columns (same Row)'s value, if one contains the other, return Y.

 

Result = if( CONTAINSSTRING(Table[Column_A], Table[Column_B]), "Y", "N").
 
But Column A has the strings like , "Xyz 19A, Xyx 19B". Column B has the string "Xyx 19".
 
Expected result is:
Column A / Column B / Result
Xyz19A, Xyx19 / Xyz19 / Y
Xyz19A / Xyz19 / N
 
But my current implementation results in:
Column A / Column B / Result
"Xyz19A, Xyx19" / "Xyz19" / Y
"Xyz19A" / "Xyz19" / Y
Can anyone help how to solve it?
1 REPLY 1
harshnathani
Community Champion
Community Champion

Hi @e2liu77 ,

 

Your requirment is not very clear.

 

CONTAINSSTRING ( <WithinText>, <FindText> )

PARAMETER ATTRIBUTES DESCRIPTION

WithinText 

The text in which you want to search for FindText.

FindText 

The text you want to find. You can use the ? and * wildcard characters; use ~? and ~* to find the ? and * characters.

 

This is performing correctly as per your current implementation.

 

Also not very clear if colum B has value Xyz19 or Xyx19.

 

Can you pls share some sample data to understand the scenario better.

 

Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.