It depends how strict you need to be with 'Season' definitions as they vary year to year...
Here is 1 way, using just the month to define -
WHEN 03 THEN 'Spring'
WHEN 04 THEN 'Spring'
WHEN 05 THEN 'Spring'
WHEN 06 THEN 'Summer'
WHEN 07 THEN 'Summer'
WHEN 08 THEN 'Summer'
WHEN 09 THEN 'Autumn'
WHEN 10 THEN 'Autumn'
WHEN 11 THEN 'Autumn'
Superstore.twbx 313.3 KB
1 of 1 people found this helpful
I am adding another apporach using "IF THEN ELSE STATEMENT".
if month( [Order Date]) = 1 or month( [Order Date])=2 or month( [Order Date])=3 then "Season-1"
elseif month( [Order Date]) = 4 or month( [Order Date])=5 or month( [Order Date])=6 then "Season-2"
elseif month( [Order Date]) = 7 or month( [Order Date])=8 or month( [Order Date])=9 then "Season-3"
Thanks I have been able to make this work using the responses above. To add a bit more assumed knowledge, I created a calculated field based on the code above, and then filtered on this calculated field. Thanks for the quick responses.
Thanks for getting back, glad its working.
As an FYI, CASE statements generally perform better than IF tests, see this article for more > https://www.interworks.com/blog/tmcconnell/2015/02/10/case-statements-vs-if-statements-tableau
You may note that in my formula I used the 'Month' calculation once, in the 2nd reply, its used 9 times. If you have a small data set it wont matter but as you scale, performance may become important.
Its something to be mindful of.