December 23, 2011 at 9:43 am
Hello,
I have these existing codes:
CASE WHEN Month(GetDate()) BETWEEN 2 AND 7 THEN 2
ELSE 1 END AS FiscalCyle
This one works, when the months fall between February to July.
There are more modifications that I need to make with the following logics work:
CASE WHEN Month(GetDate()) BETWEEN August 1st AND October 31st THEN 1
WHEN Month(GetDate()) BETWEEN November 1st AND January 31st THEN 2
WHEN Month(GetDate()) BETWEEN February 1st AND April 30th THEN 3
WHEN Month(GetDate()) BETWEEN May 1st AND July 31st THEN 4
Else ...........
End as FiscalCycle
(fiscal year starts in August - end of July)
What can I do to ensure that, it happens from August through July (Chrologolically) ?
Thanks.
December 23, 2011 at 4:09 pm
Tamrak (12/23/2011)
Hello,I have these existing codes:
CASE WHEN Month(GetDate()) BETWEEN 2 AND 7 THEN 2
ELSE 1 END AS FiscalCyle
This one works, when the months fall between February to July.
There are more modifications that I need to make with the following logics work:
CASE WHEN Month(GetDate()) BETWEEN August 1st AND October 31st THEN 1
WHEN Month(GetDate()) BETWEEN November 1st AND January 31st THEN 2
WHEN Month(GetDate()) BETWEEN February 1st AND April 30th THEN 3
WHEN Month(GetDate()) BETWEEN May 1st AND July 31st THEN 4
Else ...........
End as FiscalCycle
(fiscal year starts in August - end of July)
What can I do to ensure that, it happens from August through July (Chrologolically) ?
Thanks.
Add a "Year" component to sort on. Better yet, build a "Calendar" table.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply