YTD and LYYTD From 1st April not 1st Jan

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi,

I have been racking my brain trying to work this out!

Does anyone have an ideas on how to return data that is YTD and LYYTD with the beginning of the year being 1st April instead of the 1st of January?

The data returned would have to be between 1st April and 31st March.

The reason for 1st of April as it is the beginning of the companies financial year.
I have used three formulas to get the FY period.

{@CurrentMonthStart}
//1st of Current Month
Date(Year(CurrentDate),Month(CurrentDate),1)

{@FY Start}
if month({@CurrentMonthStart}) in 1 to 3 then
    Date(Year({@CurrentMonthStart})-1,4,1)
else
    Date(Year({@CurrentMonthStart}), 4, 1)

{@FY End}
if month({@CurrentMonthStart}) in 1 to 3 then
    Date(Year({@CurrentMonthStart}),4,1)-1
else
    Date(Year({@CurrentMonthStart})+1,4,1)-1

If you run the report as of today (Jan 2014), it will return the FY period from April 1st 2013 to March 31st 2014.
Thanks for your help, it works perfectly and I learnt something about using dates