5 Replies Latest reply on Sep 22, 2015 7:15 AM by erolst

# calculate first month of quarter

how can I find the first month of a quarter.

I found my quarter with:  ( current date: sep 21 )

```Ceiling ( Month( Get ( CurrentDate ) ) /3 )
```

returns 3

I could hard code it:

```Choose ( Ceiling ( Month( Get ( CurrentDate ) ) /3 )  ; 0;1;4;7;10 )
```

But I am looking for something to handle various fiscal starts.

• ###### 1. Re: calculate first month of quarter

I could work with 0,3,6,9 instead of months 1,4,7,10

```( Ceiling ( Month ( Get ( CurrentDate ) ) / 3 ) -1 ) * 3 + 1
```
• ###### 2. Re: calculate first month of quarter

You could try something like this:

Let ( [

m = Month ( Get ( CurrentDate ) ) ;

s = 4 ; // monthnr fiscal start

x = If ( m = s - 1 ; m - 1 ; m ) ;

Q = Ceiling ( Mod ( ( 13 + x - s ) ; 12 ) / 3 )

] ;

Q

)

• ###### 3. Re: calculate first month of quarter

thanks this is returning the quarter and now I am looking to know the first month of the quarter of a specific date.

i.e with:

```m = Month ( Get ( CurrentDate ) ) ;
s = 1
q = 3
```

I need to get a result of 7 since a September date is in the third quarter and the first month of 3Q is 7

• ###### 4. Re: calculate first month of quarter

found it

`First Month of Quarter = Int((Month - 1) / 3) * 3 + 1`
• ###### 5. Re: calculate first month of quarter

rivet wrote:

thanks this is returning the quarter and now I am looking to know the first month of the quarter of a specific date

Isn't that

Ceiling ( Month ( date ) / 3 ) * 3 - 2