i'm pretty new to the sql world and i've seem to run into a roadblock. Multiple conditions seems to be a regular question but I couldn't find a thread on my current problem. I'm using google data studio and have a dataset in google sheets that includes multiple terms and I want to know how many times each term shows up. Here's and example of my dataset and current written statement
Sample Dataset from the Column labeled "Answer"
- mini
- profanity
- mini, profanity
- mini, recorded
- credit bureau
- Suspicious
CASE
WHEN CONTAINS_TEXT(Answer,"Credit Bureau") THEN "Credit"
WHEN CONTAINS_TEXT(Answer,"Mini") THEN "Mini"
WHEN CONTAINS_TEXT(Answer,"Profanity") THEN "Profanity"
WHEN CONTAINS_TEXT(Answer,"Bankruptcy") THEN "Bank"
WHEN CONTAINS_TEXT(Answer,"Recorded") THEN "Recorded"
WHEN CONTAINS_TEXT(Answer,"Suspicious") THEN "SAR"
ELSE "Other"
END
This statement works perfectly for cells that ONLY contain these terms. However the problem is that in the dataset there are multiple occurrences of the terms showing up in the same cell. Unfortunately the statement will only count the first term and ignore the others, giving me inaccurate totals. For example, in the mini dataset i provided, even though you see profanity twice, it would only be counted once. Does anyone know any potential workarounds or suggestions? Any help would be appreciated.