8 Replies Latest reply on Jan 17, 2018 8:34 AM by Lisa Lacroix

Group months by season

Have tried using the month function for this, but can't get it to work. I am trying to group months into seasons using a calculation to group the months by season as seen below:

This is the calculation is unsuccessfully attempted:

if (Month([Incident Date] = 12)) or

(Month([Incident Date] = 1)) or (Month([Incident Date] = 2)) then 'Winter'

elseif

(Month([Incident Date] = 3)) or

(Month([Incident Date] = 4)) or (Month([Incident Date] = 5)) or

(Month([Incident Date] = 6)) then 'Spring'

elseif

(Month([Incident Date] = 9)) or

(Month([Incident Date] = 10)) or (Month([Incident Date] = 11)) then 'Fall'

END

• 1. Re: Group months by season

I think you had some extra parenthesis in there

Try this:

if (Month([Ship Date]) = 12 or Month([Ship Date]) = 1 or Month([Ship Date]) = 2) then 'Winter'

elseif

(Month([Ship Date]) = 3 or Month([Ship Date]) = 4 or Month([Ship Date]) = 5 or Month([Ship Date]) = 6) then 'Spring'

else 'Fall' END

1 of 1 people found this helpful
• 2. Re: Group months by season

Taking this one step further, is there a way to allow users to select which months they would consider "winter" and then just have the opposite of that selection be summer?  No need for Spring/Fall.

• 3. Re: Group months by season

That's really BIG one step, anyways, something like this?

Need to use parameters.

[Season Definition]

if datepart('month',[Ship Date])>= [Winter Starts |->]

and  datepart('month',[Ship Date])<= [->|  Winter End]

or [Winter Starts |->] > [->|  Winter End]

and (datepart('month',[Ship Date])>= [Winter Starts |->]

or datepart('month',[Ship Date])<= [->|  Winter End])

then "Winter"

elseif datepart('month',[Ship Date])>= [ Summer Starts |->]

and  datepart('month',[Ship Date])<= [->| Summer End ]

or [ Summer Starts |->] > [->| Summer End ]

and (datepart('month',[Ship Date])>= [ Summer Starts |->]

or datepart('month',[Ship Date])<= [->| Summer End ])

then "Summer"

else "Other"

end

Same value with different title x 4 (Start , end x S,W)

Thanks,

Shin

1 of 1 people found this helpful
• 4. Re: Group months by season

BTW Aaron,

I recommend that you create another post to ask your question in this case, because it's quite difficult to track new info on one year old post.

Actually this might be good hint for other people if you put appropriate title.

Thanks,

Shin

• 5. Re: Group months by season

Shin,

Thank you for the response and solution.  I went ahead and posted a new thread earlier when I realized that this was a one year old thread

Regards,

Aaron

• 6. Re: Group months by season

OK, Good.

Regards,

Shin

• 7. Re: Group months by season

How did you calculate the 'School Year'?

• 8. Re: Group months by season

Thank you so much. This worked perfectly!