4 Replies Latest reply on Sep 2, 2015 9:06 PM by Susan Baier

    Filtering based on responses to a "check all that apply" question

    Susan Baier

      I have a question in my survey about which brand of vehicle respondents own. It's a "check all that apply" question, so in the reshaped data I have "Question" items for each option (Brand1, Brand2, etc.) with a "10" in the "Response" if the item was selected by a respondent.


      I'd like to be able to filter responses to other questions (such as "How happy are you with your current vehicle?") based on the brands selected in the question above. So, for example, I'd like to be able to see the responses only if the respondent selected Brand1 in the earlier question. Ideally, I'd have some kind of selection option on the dashboard that would allow me to choose which brand I want to see the responses for.


      If I try to set up a filter with all the Brand1, Brand 2, etc. items in it, I get a filter that shows all of the Question fields (can't seem to figure out how to show only the ones I selected.

      If anyone can steer me in the right direction I'd appreciate it.



        • 1. Re: Filtering based on responses to a "check all that apply" question
          Jonathan Drummey

          Hi Susan,


          The initial questions I ask myself when figuring things like this is out are:


          - What do I want to initially filter? (In this case, filter for certain responses to a question)

          - What is the thing that is being affected by the filter? (In this case, limiting to certain respondents)

          - What do I want to do after that (see responses to other questions)


          So in this case, the goal can be expressed as wanting to filter respondents based on a certain criteria (the response to a question), and then to display all of the responses for that respondent. In essence, this is a form of cohort analysis where the cohort is being defined in Tableau. There are a variety of ways to do this, here are ones I can come up with quickly:


          A. Create a worksheet showing the list of Brands and the Respondent ID on the Level of Detail. Hide the marks by setting the color to white, transparency to 0%, size to smallest, and removing the borders. Set up a target worksheet that has the responses. Then build a dashboard with 1st worksheet using a Filter Action on the Respondent ID targeting the 2nd worksheet. Here I've done this with Superstore using Category as a stand-in for Brand and Customer ID as a stand-in for Respondent ID:


          2015-03-13 09_47_14-Tableau - Book4.png


          B. Use a conditional filter (in this case embedded in a Set) based on a parameter:


          2015-03-13 09_51_40-Tableau - Book4.png


          C. Instead of using a parameter, using a duplicate connection to the data source for a self-blend on only Customer ID while filtering for the Category:


          2015-03-13 09_52_55-Tableau - Book4.png


          An advantage to this technique over the parameter one is that multiple selection is possible, though it does introduce additional complications. See Creating a Dynamic “Parameter” with a Tableau Data Blend | Drawing with Numbers for details.


          D. Set up a cross product on your data so all the chosen brands become members of a new dimension, then use that dimension to filter. You'd need to be careful how any aggregation happens due to the multiplied data.


          I set up examples of A through C in the attached.



          • 2. Re: Filtering based on responses to a "check all that apply" question
            Susan Baier

            This is great, Jonathan - thank you so much for your thorough explanation of the options! I'll go through them all.


            You are so generous with your support, and I'm very grateful. Thank you.



            • 3. Re: Filtering based on responses to a "check all that apply" question
              Alex Cook


              Perhaps you already solved your issue but I recently ran into this and came up with a solution so thought I'd share. In addition to Jonathan's suggestions, I have a slightly different approach that worked for me. Assuming you have a survey response ID, you can do a blend on that ID that allows you to filter on, in your case, Brand. Here's how I did it.


              1) Set up your normal data as the primary datasource (either with or without the brand-based questions, doesn't matter).

              2) Create a copy of your data and keep only the Brand-related questions, as per the following:




              The data can be 0s & 1s, or Brand1s & Brand2s, it doesn't really matter what the value is.


              3) Reshape your data (in Excel or using Tableau's Pivot feature), so now it looks like this:




              4) Then filter it down only to those instances of a positive response (i.e. where Value=1), again either in Excel or Tableau. You can also remove the Value column since we don't need it anymore. Now your data looks like this:





              5) Connect to this reshaped dataset as your secondary datasource and blend on ID only. You should now be able to add "Brand" as a filter to any dashboard or viz and it will return only those IDs that satisfy the criterion of whether that person indicated they owned the brand or not. There is one serious downside to this approach which is that you can't filter groups in a primary datasource from a secondary datasource, so any groups you are using in your primary will need to be converted to calculated fields or addressed in some other way.


              Hope this helps!


              • 4. Re: Filtering based on responses to a "check all that apply" question
                Susan Baier

                Thank you Alex! This is an interesting approach. I'm going to give it a whirl. Appreciate the suggestion!