3 Replies Latest reply on Jan 19, 2017 10:50 AM by simonpsmith

# Using Get(CurrentDate) to determine Current or Last financial year quarters

I have a strange thing going on that I'd rather confirm is right rather than 'just use it as it seems to be working'.

In my solution I have a reports page where you can either enter the reporting period start and end dates manually, or click on one of eight buttons that will fill in these global start/end dates for the most commonly required reporting periods (quarters of the financial year April to March for the current or previous year).

So as of today 19/1/17 (UK date system - although I know FM 'works' in US order so that’s not my issue) the buttons should fill in:

Current Year

1st Qtr = 1/4/16 to 30/6/16

2nd Qtr = 1/7/16 to 30/9/16

3rd Qtr = 1/10/16 to 31/12/16

4th Qtr = 1/1/17 to 31/3/17

Last Year

1st Qtr = 1/4/15 to 30/6/15

2nd Qtr = 1/7/15 to 30/9/15

3rd Qtr = 1/10/15 to 31/12/15

4th Qtr = 1/1/16 to 31/3/16

To make this work I have a script for each button which (I thought) were working to determine which month of the year we are currently in, and so would change the 'year' part of the date to be entered accordingly.

So at 31/12/16 the current year 1st Qtr ‘year’ should be represented by Year(Get(CurrentDate)), whereas at 19/1/17 the ‘year’ should be represented by Year(Get(CurrentDate))-1

My issue is that to make it work correctly, by looking at the current month, it seems I have to use the greater or less/equal symbols in the wrong direction in the formulae, unless I’m missing something really really basic.

IF [Get(CurrentDate)  ≤ Month (3)] for January 17 to March 17, should make the start date ‘current year minus one’, but I’m having to enter it as ‘IF[Get(CurrentDate)  ≥ Month (3)]’.

Surely the first statement is looking for if the current month date is smaller or equal than the 3rd month, and so would set the year as current minus one…

Attached is what should work, and what is working…

although I know FM 'works' in US order so that’s not my issue

• ###### 1. Re: Using Get(CurrentDate) to determine Current or Last financial year quarters

IIUC, the check would simply be

Month ( Get ( CurrentDate ) ) < 4

• ###### 2. Re: Using Get(CurrentDate) to determine Current or Last financial year quarters

Month (3)

Makes no sense here. The parameter to the month function has to be a date. If you use a number, that number gets converted to a date--which in this case would be very different from the current date.

• ###### 3. Re: Using Get(CurrentDate) to determine Current or Last financial year quarters

I had been working on the assumption that 'Month (3)' was putting 'March' into the equation as it all seemed to work up until now. I think it was more by luck that judgement that it did until the year changed...

Making the change to erolst's answer has worked a treat.

Thank you both for coming back to me again!