2 Replies Latest reply on Apr 23, 2013 1:21 PM by Christine Capra

    Assign single text element to multiple categories.

    Christine Capra

      I'm trying to visualize responses to 4 open-ended comment questions in a survey. 


      Each response may be just one short phrase, or a long paragraph.  I want to put them into categories/themes so I can represent how frequently the various themes come up.


      Each response can easily fall into more than one category - such as 'This is a very important topic, and the speaker was so lame he didn't do it justice' so - the categories might be 'speaker bad' and 'topic important'.


      Sometimes also - a response to one question (such as 'what did you like about the event') may also be an answer to another question (such as 'what didn't you like about the event?) - for example 'This is a very important topic, and the speaker was so lame he didn't do it justice' not only falls into two categories ('speaker bad' & 'topic important') but it also addresses both those questions (1. liked/ 2. didn't like).


      So - it's like a venn diagram of overlapping questions & comment themes, and I often need to assign text cells to more than one of each.


      Is this even possible? What's my best approach?


      I'll be doing this is Tableau Public 8.


      Message was edited by: Christine Capra

        • 1. Re: Assign single text element to multiple categories.
          Mark Holtz

          Hi Christine,

          That's challenging indeed.

          I've done something similar before where I scour text strings for certain keywords or phrases and then try to make counts for "categories."


          I think you generally have two paths you could follow:

          Option #1 (much easier by far) create a "counter" measure field to aggregate each "category" individually. Essentially, it's a bit value/true-false field with 1 when the "string match condition" is met somewhere in the text string, and 0 when it is not.


          Option #2 would be to try to create a SINGLE field that categorizes every line. Here, I generally would create some sort of "hierarchy" of answers. If you find a more important category within a response, then you would let that take precedence over a "lower" category. 


          Let's use your example of 'important topic' and 'bad speaker.'

          For #option 1, you'd essentially bring in a count for each category. You would then have access to all the measures collectively by using the special Measure Values shelf.


          The formula for the "Topic Important" category counter would be something like:
          IF CONTAINS([ResponseField],'topic is important')
          OR CONTAINS([ResponseField],'this is an important topic')
          THEN 1 ELSE 0 END

          Then your "Speaker Bad" category count would be:
          IF CONTAINS([ResponseField],'speaker sucks')
          OR CONTAINS([ResponseField],'speaker was so lame')
          OR CONTAINS([ResponseField],'speaker was awful')

          THEN 1 ELSE 0 END


          For Option #2, let's say for whatever reason "Speaker Bad" is more important than "Topic Important." But having both would trump either by itself.


          So, it'd be something like:

          IF ([Speaker Bad]=1 AND [Topic Important]=1) THEN 'Speaker Bad and Topic Important'
          ELSEIF [Speaker Bad]=1 THEN 'Speaker Bad'
          ELSEIF [Topic Important]=1 THEN 'Topic Important'
          ELSE 'Unknown' END

          As you can see, it quickly gets hairier as you introduce a third or more option... I'd tend to recommend trying to tackle this using Option #1 and creating an "event" trapper that will give you each result.


          Sorry so long as disorganized. Hope this helps. Good luck!

          1 of 1 people found this helpful
          • 2. Re: Assign single text element to multiple categories.
            Christine Capra

            Thanks Mark,


            Yeah - that makes sense, I see where you're going with both of them (and, yes, #2 would become a monster pretty quickly). I think I need to re-think my whole approach & may have to post another question or two, but your input helps - thank you,