3 Replies Latest reply on Apr 26, 2017 8:58 AM by Alim M

    Survey MAX of

    Alim M

      Hello,

       

      I need some help with the survey I'm working on.

       

      I have some data from 2 surveys, Survey A and B.

      I am comparing results of each survey.

      I want to display which survey had highest response number for each answer choice.

      See screenshot.

      Thank you very much.

       

      P.S. I have attached Excel spreadsheet I'm working with. I'm using Tableau Public.

      Example MAX Screenshot.jpg

        • 1. Re: Survey MAX of
          Eric Summers

          Hi Alim,

           

          LOD expressions should fix give you what you are looking for.  On the left in this screen you can see the original view and on the right the survey code that prevailed. This was good for validation. For simplicity, I created three calculated fields to accomplish this. You could probably combine them though.

           

          1. surveyA -

                  IF [Survey Code] = 'A' THEN [Measure]

                  END

          2. surveyB

                  IF [Survey Code] = 'A' THEN [Measure]

                  END

          3. surveySelect - LOD

                    IF { FIXED [Sub-Question #],[Answer Text]: SUM([surveyA])} >

                        { FIXED [Sub-Question #],[Answer Text] : SUM([surveyB])}

           

                        THEN [surveyA]

                        ELSE [surveyB]

                    END

           

          Hope this is what you are looking for.

           

          1 of 1 people found this helpful
          • 2. Re: Survey MAX of
            Eric Summers

            I just caught that the selectSurvey field chooses B over A when they are equal. See 10_5 "likely not purchase". You should add another line of logic to catch those.

            1 of 1 people found this helpful
            • 3. Re: Survey MAX of
              Alim M

              Hi Eric,

              That's exactly what I was looking for, thank you.

               

              I have a follow-up question if you don't mind.

               

              Let's say I want to accomplish the same objective, but instead of displaying individual answers I want to compare the sums of  "Definitely Purchase" and "Likely Purchase" for each sub-question.

               

              I have tried adjusting surveySelect LOD expression by removing [Answer Text] but the result is not 100% accurate. See screenshot. Any suggestions?

               

              IF { FIXED [Sub-Question #] : SUM([SurveyA])} >

                            { FIXED [Sub-Question #] : SUM([SurveyB])}

               

                            THEN [SurveyA]

                            ELSE [SurveyB]

                        END

               

              Example MAX Screenshot2.jpg