4 Replies Latest reply on Dec 21, 2016 2:49 PM by Aaron Lipke

    Allow users to select which months are considered "Winter Months"

    Aaron Lipke

      Hello Tableau Community,

       

      I am making a transit time comparison dashboard that compares transit time during "Summer Months" vs "Winter Months".  Currently, I'm manually grouping the months into "Winter" and "Summer" categories.  Winter being November - April, Summer May - October.  Ideally though, I'd prefer to allow the user to select which months they consider "Winter Months" since depending on the region, transit times would probably only be effected during icy conditions.  (So maybe a user would only care about January - February transit differences)  The desired approach would be to have a multiple selection drop down where a user could check the months that are winter and the unchecked be summer.

       

      In my actual workbook I've been able to create a parameter with predefined month ranges for winter (Nov - Apr, Nov - March, Nov - Feb) and used a nested case to achieve this, however, still not as useful as allowing the end user to select the months themselves.  I can't upload my actual workbook due to sensitive proprietary data but the packaged workbook attached has the same things going on, with dummy data.

       

      Any help with this would be greatly appreciated!

        • 1. Re: Allow users to select which months are considered "Winter Months"
          Eli Blankers

          Hi Aaron,

           

          Would it make sense to create 2 parameters where you select the first month and last month of winter?  Then you would create a calculation that finds

          IF DATE < EndingWinterMonth AND DATE > StartingWinterMonth THEN "Winter" ELSE "SUMMER" END

           

          Regards,

          Eli Blankers

          1 of 1 people found this helpful
          • 2. Re: Allow users to select which months are considered "Winter Months"
            Aaron Lipke

            Eli,

             

            Thank you for your prompt and rather ingenious response!  This worked in every scenario where the StartMonth number was greater than the EndMonth number.  However, when the StartMonth is less than the EndMonth, the entire "MonthSet" is "Winter".  See attached.  Change Winter Start Month from Dec to Jan to see the problem.

             

            Thank you again!  This has been a bane in my side for longer than it should have.

            • 3. Re: Allow users to select which months are considered "Winter Months"
              Eli Blankers

              Hi Aaron,

               

              Glad this was helpful.  If you wanted to expand your logic for this problem to behave correctly in any scenario (end > start, start > end, start = end), then take a look at these two unconventional calculations (could probably be written better but I threw it together and it worked):

               

              Winter Overlay:

              IF [Winter Start Month] > [Winter End Month] THEN "Over 2 Years"

              ELSEIF [Winter Start Month] < [Winter End Month] THEN "In Year"

              ELSE "One Month"

              END

               

              New Seasonality

              IF [Winter Overlay] = "In Year"

              THEN IF [Ship Date (Months)] >= [Winter Start Month] AND [Ship Date (Months)] <= [Winter End Month] THEN "Winter" ELSE "Summer" END

              ELSEIF [Winter Overlay] = "Over 2 Years" THEN IF [Ship Date (Months)] >= [Winter Start Month] OR [Ship Date (Months)] <= [Winter End Month] THEN "Winter" ELSE "Summer" END

              ELSE IF [Ship Date (Months)] = [Winter End Month] THEN "Winter" ELSE "Summer" END

              END

               

              Cheers,

              Eli Blankers

               

              PS:  After writing this out, I do realize these two calculations could be easily combined, but it made more sense to write them separate at the time...

              1 of 1 people found this helpful
              • 4. Re: Allow users to select which months are considered "Winter Months"
                Aaron Lipke

                Eli,

                 

                I was actually able to figure this part out!  Attached for anyone interested.

                 

                Thank you again for your intuition!

                 

                Regards,

                Aaron

                 

                edit:  It appears you were replying with your admittedly more elegant solution while I was posting ;-P   Thank you again for your help and Happy Holidays!

                1 of 1 people found this helpful