Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last Year's YTD

Status
Not open for further replies.

blueboyz

Technical User
Sep 13, 2005
210
US
I am using Quantum 2009 with Crystal Reports v9--pervasive sql.

I have a report that lists items and displays the quantity sold by month and the sales amount by month and the last column is the YTD (year-to-date). I need the report to also show me the YTD column for Last Year.

There is a date range parameter and a selection statement:
{JrnlRow.RowDate} = {?Report Date Range}

I don't need to show Last Year's quantity sold by month or the Last Year's sales amount by month. I just need to show what the YTD Total quantity and YTD Total sales were for Last Year.

For example, if today is March 26, 2009, then I want to see the YTD for quantities sold and sales amount as of March 31, 2008.

Is there a formula I can use to get Last Year's YTD figures?

Item Jan Feb Mar........ YTD Last Year YTD
A 10 10 5 25 20
$100 $100 $50 $250 $200

B 5 5 10 20 10
$50 $50 $100 $200 $100



 
There is a LastYearYTD function, but it is based on currentdate, and you seem to want the end of the month. You would also have to change your selection criteria to:

{JrnlRow.RowDate} = {?Report Date Range} or
{JrnlRow.RowDate} in dateadd("yyyy", -1, minimum({?Report Date Range})) to dateadd("yyyy", -1, maximum({?Report Date Range}))

You could use the second clause in a conditional formula for your additional columns. I think the only issue might be that if you selected a daterange ending 2/28 and the previous year was a leap year, the 2/29 would not be included in the previous year's calculation with this particular clause.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top