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
Anonymous
Not applicable

IF CONTAINS Formula

Greetings Everyone. 

I am trying to create a formula in a new calculated column

Basically what I am trying to do is: 

 

IF (text.in.row contains "ABC", "ABC") OR (text.in.row contains "EFG", "EFG") OR (text.in.row contains "XYZ", "XYZ") 

 

I did stumble upon this formula: 

CustomColumn = IF(
	ISERROR(
		SEARCH("A", TableName[ColumnName])
	),
	"A",
	"B"
)

Which did work for the first argument, but, the only issue is, it's not letting me do multiple IFs or multiple scenarios. 

 

Appreciate any help I can get. Doesn't have to be this particular formula, any formula to get me there would help

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Something like this should work for you.

 

Column =
IF ( CONTAINSSTRING ( Table[Column], "ABC" ),"ABC",
    IF ( CONTAINSSTRING ( Table[Column], "EFG" ),"EFG",
        IF ( CONTAINSSTRING ( Table[Column], "XYZ" ), "XYZ", "" )
    )
)

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

Something like this should work for you.

 

Column =
IF ( CONTAINSSTRING ( Table[Column], "ABC" ),"ABC",
    IF ( CONTAINSSTRING ( Table[Column], "EFG" ),"EFG",
        IF ( CONTAINSSTRING ( Table[Column], "XYZ" ), "XYZ", "" )
    )
)
Anonymous
Not applicable

You ... my friend ... are a life saver !!! It worked perfectly. 

Ashish_Mathur
Super User
Super User

Hi,

It will be ideal to create a Table with 2 columns - one listing all your search keywords and another listing all results you want to see when those search keywords are found in your Text column.  Please share your source data (could be dummy data) and this 2 column Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks for your help Ashish. 

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.