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
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
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.

Top Solution Authors