Forum Discussion
Search within a text column if one or multiple KeyWords are a match
Hi all,
I would like to know if there is a way to create a new column that looks for different keyworkds and create a list of all possible results.
For example, based on the following table
| Item | Item Description |
| a | Detail 1, Detail 2, Detail 3 |
| b | Detail 2, Detail 4, |
| c | Detail 2, Detail 6 |
I would like to create a calculated colum that contains all possible Details, so if I filter "Detail 1", the table is going to show all Items that contains "Detail 1", if I filter "Detail 2", all that contains "Detail 2", and so on.
I already tried with the following function
SWITCH(TRUE(),
IF(SEARCH("Detail 1", 'Table'[Item Description], , 0) > 0
,TRUE()
,FALSE())
,"Detail 1",
IF(SEARCH("Detail 2", 'Table'[Item Description], , 0) > 0
,TRUE()
,FALSE())
,"Detail 2",
"MISSING STATUS"
)
Here is one approach to consider. I made a disconnected table with your Detail values and used the measure below in a table visual. The row that does not include one of the selected values is automatically filtered out.
ContainsSlicerValue = VAR slicerlist = VALUES ( SlicerValues[Detail] ) VAR thisitemdesc = MAX ( T3[Item Description] ) VAR filtered = FILTER ( slicerlist, CONTAINSSTRING ( thisitemdesc, SlicerValues[Detail] ) ) RETURN IF ( COUNTROWS ( filtered ) > 0, "Y" )Pat
4 Replies
- ppm1Solution Sage
Here is one approach to consider. I made a disconnected table with your Detail values and used the measure below in a table visual. The row that does not include one of the selected values is automatically filtered out.
ContainsSlicerValue = VAR slicerlist = VALUES ( SlicerValues[Detail] ) VAR thisitemdesc = MAX ( T3[Item Description] ) VAR filtered = FILTER ( slicerlist, CONTAINSSTRING ( thisitemdesc, SlicerValues[Detail] ) ) RETURN IF ( COUNTROWS ( filtered ) > 0, "Y" )Pat
- PamelaAGFrequent Visitor
Hi Pat!
Thank you so much for your help, it seems you are getting exactly what I need.
I tried to follow your instructions, but, the moment I select something on filter, nothing happens on the table.
Did you somehow connected both tables?
- PamelaAGFrequent Visitor
I just figured it out where my mistake was! thank you so much for your help! it helped me a lot!
Thank you!
- Mahesh0016Super User
Can you share sample data and sample output in table format?