Print Page | Close Window

YTD and LYYTD From 1st April not 1st Jan

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20369
Printed Date: 11 May 2024 at 10:09pm


Topic: YTD and LYYTD From 1st April not 1st Jan
Posted By: twistednerve
Subject: YTD and LYYTD From 1st April not 1st Jan
Date Posted: 20 Jan 2014 at 5:23pm
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.



Replies:
Posted By: lolly54
Date Posted: 20 Jan 2014 at 9:39pm
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.


Posted By: twistednerve
Date Posted: 23 Jan 2014 at 4:52pm
Thanks for your help, it works perfectly and I learnt something about using dates



Print Page | Close Window