13 Replies Latest reply on Aug 30, 2016 9:56 AM by Erika Ruiz

    How can I make multiple answers question a filter?

    Erika Ruiz

      Hi everyone!

       

      I am trying to use multiple answer questions as filters, I created a calculated field to have count of the each option but I haven't been able to create a filter from that count. For example the question 4 is "What is the goal of your innovation strategy? (Check all that apply)" options are Achieve growth, Change employee mindsets , Create a new enterprise-wide culture, etc. the calculated field tells me number of times each color was selected. But now what I need is to use this as filters so I can select people how choose "Achieve growth" or "Save cost" and see the changes on the answer along the full survey. Is that even possible? The questions I want to convert to filters will be 4 and 6.

        • 1. Re: How can I make multiple answers question a filter?
          Joe Oppelt

          Actually, it's going to depend on how you've set up your data, I think.

           

          Don't let "proprietary" get in the way.  Hack up an anonymized version of your data structure.  Maybe a few dozen rows in an excel file.

           

          Follow the steps here:

           

          Anonymize your Tableau Package Data for Sharing

           

          Yes, it might take some effort, but nothing beats a concrete example to drill into a concrete solution around here. 

          • 2. Re: How can I make multiple answers question a filter?
            Erika Ruiz

            Thanks for the tip, I had uploaded a part of my work and provided a more accurate description of what I am trying to achieve. Any ideas are welcome.

            Thanks

            • 3. Re: How can I make multiple answers question a filter?
              Joe Oppelt

              (Note to self:  10.0 workbook.)

               

              So looking at [4.What is the goal...]...

               

              See attached.  On sheet Q4.  I used your existing [Achieve Growth] calc and made a new one called [Achieve Growth?].  Just set "1" or "" accordingly.  (For the record, I prefer to use integer 1 or 0.  Then you can easily to SUM([that calc]) and do math on it and all.  But that's just a matter of style.  Also, tableau uses the integers as measures whereas the character strings become dimensions.  Again, not a big deal, but it's just my preference.  Here I kept the character paradigm.)

               

              I added the new calc to filters, and selected for "1".  Now your [Achieve Growth] bar is 100% because it has grabbed only those rows that selected that in Q4.  You'll just have to put up with a million little calcs like this to parse out all the multi-choice fields.

              • 4. Re: How can I make multiple answers question a filter?
                Erika Ruiz

                Thank you, this will do the trick for now.. I will definitely need to find a way to do it more efficiently..

                • 5. Re: How can I make multiple answers question a filter?
                  Erika Ruiz

                  I got an idea based on your answer, but it only counting achieve value and develop new products... any idea how to fix it?

                  I created a new calculated field with this:

                  IF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Achieve growth')= true THEN '1'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Change employee mindsets,')= true THEN '2'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Create a new enterprise-wide culture')= true THEN '3'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Develop new products')= true THEN '4'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Generate sale')= true THEN '5'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Identify new business opportunities')= true THEN '6'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Improve employee engagement')= true THEN '7'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Improve processes')= true THEN '8'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Save costs')= true THEN '9'

                  ELSEIF CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],'Other')= true THEN '10'

                  ELSEIF ISNULL([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth]) THEN '99' END

                  • 6. Re: How can I make multiple answers question a filter?
                    Joe Oppelt

                    When you have multiple "IF" layers in a calc, when Tableau hits the first "TRUE" condition it stops evaluating the calc.  You can only get one value out of a calc at a time.  If you have multiple conditions that can be met, you'll only get the first one it hits.

                     

                    You need to go with the separate calcs.

                    • 7. Re: How can I make multiple answers question a filter?
                      Erika Ruiz

                      My problem is that I have 5 questions like this one and each one has more than 10 answers.. is there a way to combine those calculated fields to have one filter for each question?

                      • 8. Re: How can I make multiple answers question a filter?
                        Joe Oppelt

                        I hacked up another idea in the attached.  See the Q4 sheet.

                         

                        I created a parameter with values from one of the rows in your data set.  I don't know if it contains all the possible answers, but it's a start.

                         

                        I took the filter I had previously made off the filter shelf, and I put [4. What is the goal ...] on the filter shelf.  And then for the filter I selected the CONDITION tab.  In there I added this condition:

                         

                        CONTAINS([4. What is the goal of your innovation strategy? (Check all that apply)-Achieve growth],[Question 4 values])

                         

                        The limitation here is that you can only look for one at a time because parameters are single-value creatures.

                         

                        You can also add another value to the Parameter: "ALL".  And the condition can be:

                         

                        [Question 4 values] = "ALL" or

                        CONTAINS( ...

                         

                        If you are doing "one or all" for the filter, then this will work for you.  You won't need dozens of calcs to manage the selections.  You just have to have one parameter per multi-choice question.

                         

                        But if you will also need to look for "A or B" , or look for "A and B", (and all the possible permutations for a question), the parameter option isn't going to be for you.

                         

                         

                        Take a look and see what this does for you.

                        • 9. Re: How can I make multiple answers question a filter?
                          Erika Ruiz

                          Hi Joe,

                           

                          That is exactly what I did, but like you said it only allows one choice at the time meaning that I have 5 parameter controls and multiple combinations depending on the selections. I really appreciate your time & help. One last question, currently I have all my five parameter controls what I am trying to do is create a parameter with on/off so I can control  when I want the parameter to be active and when I wanted ignored... I hope that makes sense.. Any idea? I tried creating parameter list on/off and then case on/off question 4 "when parameter ="on" then question 4 values end" but the problem is won't show me values.. goes blank

                          • 10. Re: How can I make multiple answers question a filter?
                            Joe Oppelt

                            Like I pointed out, you can have a choice of "ALL" in each of the parameter lists, and check for parameter="ALL" OR CONTAINS...

                             

                            When any parameter is set to "ALL" and you have that check in the filter condition, you are essentially turning that parameter off.

                             

                            You could even add one more parameter.  [Obey Parameters].  Values would be Y or N.

                             

                            At the front of each of those condition filters add this:

                             

                            IF [Obey Parameters] = "N" OR

                            [Parameter 4] = "All"  OR

                            CONTAINS( ...

                             

                            So your condition (on each filter) first checks if [Obey] is on.  If not, then just grab everything.  No matter what the question-specific parameter is set to, ignore that and just get everything.  that way, if you want to "turn off" all the parameters, one click will do it.

                            • 11. Re: How can I make multiple answers question a filter?
                              Erika Ruiz

                              I am not sure I understand your suggestion, this what I have. I created a parameter control in both parameter and calculated fields. Note how everything gets canceled.

                              • 12. Re: How can I make multiple answers question a filter?
                                Joe Oppelt

                                I think I was looking at it backward from the way you are approaching it.

                                 

                                From what I see there, you want the parameter control to decide which one parameter (or all) to take effect.  My approach would be the equivalent to adding a parameter control choice of "NONE" to your list.  (That is to say, essentially turn off the filters for all the questions and just get all rows.)

                                 

                                I modified the conditions for your [4. ...] and [6. ...] filters.  And I took off the [parameter control] calc filter from the filter shelf entirely.

                                 

                                The conditions for each essentially says this:

                                 

                                If this filter should be in effect, then do the CONTAINS stuff.

                                 

                                And the way I tell if the filter should be in effect is if the parameter control is set to ALL or is set to this specific question.

                                 

                                And at the end of the condition I say, "If this filter is not in effect, then get all rows".


                                For the record, if you added a choice of "NONE" to the parameter control list, you wouldn't have to change anything in the condition for either filter.  The value of "NONE" would satisfy that last part for each condition as they are already written.

                                1 of 1 people found this helpful
                                • 13. Re: How can I make multiple answers question a filter?
                                  Erika Ruiz

                                  Seriously Joe you are awesome!! Thank you so much!!