The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Appreciate any help on lookup keyword using "Search" table to find whether there is any match in text table ("String" table).
If any keyword in "Search" table found in "String" table, show as "TRUE".
If there is no word in "Search" table found in "String" table, show as "FALSE".
Keyword in "Search" table can be either upper and lower case.
Both my "Search" table and "String" table can be quite long list.
I have used CONTAINSSTRING to create a new table in Power Bi but the output is not correct.
Last 2 rows Within approved budget amount and Event to hold during peak tourist season should be "FALSE" and not "TRUE".
My code is :
Table1 =
ADDCOLUMNS(String,
"containsString",
CONTAINSSTRING ('String'[String], SELECTEDVALUE(('Search'[Search]))))
In addition, appreciate your assistance to count the number of rows in "Search" table found in "String" table. Thank you very much.
POWER BI :
Solved! Go to Solution.
@Wendy_WL Can you post sample data as text? Expected results would help as well.
Without testing, I would think adding a coumn to your String table like this would be the way to go:
ContainsString Column =
VAR __String = [String]
VAR __Table =
ADDCOLUMNS(
'Search',
"Found", CONTAINSSTRING( __String, [Search] )
)
VAR __Result = IF( COUNTROWS( FILTER( __Table, [Fouund] = TRUE() ) ) > 0, TRUE(), FALSE() )
RETURN
__Result
Thank you very much, Greg. Your DAX codes work.
Another question: I add a "Site" table. If there is any match to "Site" table, then show Result and List out the keyword found. Appreciate if you could help me to list out keyword found as shown in blue font under "Found List".
Another Question: I follow your codes to create 2 columns "Match Site Column" and "ContainsString with Condition Column".
Would it be possible to combine these 2 columns into 1 column instead of creating 2 separate columns.
@Wendy_WL Can you post sample data as text? Expected results would help as well.
Without testing, I would think adding a coumn to your String table like this would be the way to go:
ContainsString Column =
VAR __String = [String]
VAR __Table =
ADDCOLUMNS(
'Search',
"Found", CONTAINSSTRING( __String, [Search] )
)
VAR __Result = IF( COUNTROWS( FILTER( __Table, [Fouund] = TRUE() ) ) > 0, TRUE(), FALSE() )
RETURN
__Result
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
32 | |
13 | |
10 | |
10 | |
9 |