4 Replies Latest reply on Dec 27, 2012 9:32 AM by delibebek

# Calculating a Quarter of the Year from a date field

### Title

Calculating a Quarter of the Year from a date field

### Post

No Laughing...

Here is my calculation:

CloseOutQuarter =

Case ( CloseOutMonth = 1; 1; CloseOutMonth = 2;1;CloseOutMonth = 3;1;CloseOutMonth = 4;2;CloseOutMonth = 5;2;CloseOutMonth = 6;2;CloseOutMonth = 7;3;CloseOutMonth = 8;3;CloseOutMonth = 9;3;4)

Although it does work, I am wondering if there is a better way. One that doesn't look so "clunkity-clunk".

Thanks,

Jack sends

FMP9, iMac OSX

• ###### 1. Re: Calculating a Quarter of the Year from a date field

Try:

Ceiling ( Month ( YourDate ) / 3 )

• ###### 2. Re: Calculating a Quarter of the Year from a date field

Hey! There is nothing Clunkity-Clunk about that.

Thanks,

Jack sends

• ###### 3. Re: Calculating a Quarter of the Year from a date field

If you want to know which quarter of the year a date falls in, why divide by 3? Why not 4? Sorry if it's really simple but I don't get it...

• ###### 4. Re: Calculating a Quarter of the Year from a date field

Why not divide by 4?

If you apply this to the months, 12 being December, you see that you get 3. Dividing the number of months by 4 tells us how many months are in a quarter, but we're trying to reduce the numbers to fit into the range of each quarter. For the first three months, the number should fall between 0 and 1, with the ceiling function taking it to 1. Dividing by three does that properly with each quarter.

For many purposes, the number of each quarter is defined by the fiscal year (OCT 1 - SEP 30), so the simple solution doesn't satisfy. To account for the final three months of the year being the first quarter, I would add 3 to the month and use the modulo function to capture that as a remainder before dividing by 3:

Ceiling (  (  Mod  (  Month (  YourDate )+3; 12 )  )  / 3 )