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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Measure with IF( CONTAINSSTRING

Hi 😀
Help me please
I want to create Measure like

IF(CONTAINSSTRING( table[text_col] ,"ABC"), TRUE(), FALSE())

This formula as is doesn't work. What is wrong?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

In meantime I found solution

 
SUMX(
       FILTER(
            table,
            CONTAINSSTRING(table'[string_col], "ABC")),
        1)


It come from this page 

View solution in original post

6 REPLIES 6
Jija
New Member

You may create a column! 

CONTAINSSTRING( table[text_col] ,"ABC")

or

CONTAINSSTRINGEXACT( table[text_col] ,"ABC") (case sensitive)

 

You may check Youtube: ColorfulAnalysis 

CONTAINSSTRING || CONTAINSSTRINGEXACT

 

Anonymous
Not applicable

In meantime I found solution

 
SUMX(
       FILTER(
            table,
            CONTAINSSTRING(table'[string_col], "ABC")),
        1)


It come from this page 

JorgePinho
Solution Sage
Solution Sage

What error are you getting? Are you creating a measure or a column?

Anonymous
Not applicable

Hi, I want to create Measure. this formula works in Column but in Measure it return error

 

"A single value for column 'table'[text_col] cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."

 

There is missing some Iterator, but I don't know which one a where it must be placed in code.

 

Since you don't want a calculated column, it is missing an aggregator. I don't know what you pretend to do with the measure. If you're idea is to use it in a table visual then you can do something like this:

IF(CONTAINSSTRING( MAX(table[text_col]) ,"ABC"), TRUE(), FALSE())

 

Anonymous
Not applicable

it doesn't work, it return False for all rows

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.