How to search for a value within a column in Power BI

Hi there,

I’m creating a calculated column in one of my tables that says:
IF( row CONTAINS “A”, put “A”, otherwise put “B”)

Anyone there who knows what the CONTAINS functions is in DAX? Thanks!

Hi there,

You could try to search the position of the text you want to find, and check for that to return an error when the text is missing:

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

But a good alternative for this DAX calculation is to do the column in the query rather than the resulting data model table. Click on the Add Custom Column and then use the code:

if Text.Contains([ColumnName], “A”) then “A” else “B”

See how you go with this.