-
1. Re: Allow users to select which months are considered "Winter Months"
Eli BlankersDec 21, 2016 12:03 PM (in response to Aaron Lipke)
1 of 1 people found this helpfulHi 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
-
2. Re: Allow users to select which months are considered "Winter Months"
Aaron Lipke Dec 21, 2016 1:44 PM (in response to Eli Blankers)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.
-
WinterMonthsExample.twbx 58.2 KB
-
-
3. Re: Allow users to select which months are considered "Winter Months"
Eli BlankersDec 21, 2016 1:59 PM (in response to Aaron Lipke)
1 of 1 people found this helpfulHi 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...
-
4. Re: Allow users to select which months are considered "Winter Months"
Aaron Lipke Dec 21, 2016 2:49 PM (in response to 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!
-
WinterMonthsExample.twbx 58.2 KB
-