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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Johannes_W
Regular Visitor

CONTAINSSTRING checking multiple inputs

Dear all,

 

I have a situation I am sure should be possible to resolve, but I can not crack it.

 

I have several unique processes (A, B, C, D .. ) that have error_ids associated to them, some only a few, some hundreds

 

Table1

Process_id error_ids
Atree
Aapple
Amouse
Btree
Bhorse
Cdesk
Ctiger
Dtree
Dmouse
Dhorse
Dtiger

 

 

All these processes also have messages associated to them, again, some only a few, others up to a hundred.

Only this time, the messages are convoluted strings.

 

Table2

Process_id event_message 
Atree mouse sequenze
Aapple pie
Asome text
Bsome more
Cdesktop
Cmouse soup
Dtree house
Dmouse house
Dwooden desk

 

 

I am trying to create a calculated col that gives me true/false if ANY of the error codes that belong to a process appears in the event_message. Or in other words, 'go through the evene messages one by one and check if any of the error codes of the corresponding process appears in the the message'

 

The expected result would be:

 

Table2 - with new col

Process_id event_message error found?
Atree mouse sequenceTrue
Aapple pieTrue
Asome textFalse
Bsome moreFalse
CdesktopTrue
Cmouse soupFalse
Dtree houseTrue
Dmouse houseTrue
Dwooden deskFalse

 

I have a solution for a SINGLE error code (like 'tree')

 

 

 

error_found? =  
VAR get_error = 
CALCULATE(  
FIRSTNONBLANK( 
Table1[error_ids],1), filter( ALL(Table1), Table1[error_ids] = 'tree' && 'Table2'[Process_ID] = 'Table1'[Process_ID])) 
RETURN 
CONTAINSSTRING('Table2'[even_message], get_error ))

 

 

 

but that is of limited use to me. I also can not predict how many error codes a process could have. So I need to find a solution that turns a column of error codes over to COINTAINSSTRING, somehow.

 

I apprechiate all your help!

Thanks

Joh

2 REPLIES 2
amitchandak
Super User
Super User

@Johannes_W , Try like

 

new column =
var _cnt = countx(filter(Table1, search(Table1[error_ids], Table2[event_message],,0)>0 && Table1[Process_id] = table2[Process_id]), Table1[Process_id])
return
if(not(isblank(_cnt)), True(), false())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi! Thanks for this suggestion, but it returns FALSE for me for every row which can not be true.

 

 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.