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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quarter-Over-Quarter and YTD-Over-YTD

Status
Not open for further replies.

JLB2

Technical User
Aug 16, 2010
2
US
I am new to this forum and to crystal reports. I am currently using CR2008.

I am trying to figure out how to query information to show the previous quarters data (i.e. on April 4, 2010 show data for Jan 1, 2010 to Mar 31, 2010 and compare it to the previous years same quarter results (i.e. Jan 1, 2009 to Mar 31, 2009).

In addition, I would like to show all completed quarters YTD totals for the current year (i.e. October 4, 2010 show data from Jan 1, 2010 to Sep 30, 2010) and compare that to previous years YTD totals for the same time period (ie Jan 1, 2009 to Sep 30, 2009).

I am not sure if a cross tab is the way to go, but ideally I would like to set it up as follows:


Month 2nd Qtr 2009 2nd Qtr 2010 | YTD 2009 YTD 2010
April |
May |
June |

Lastly, I would like to automate the report so I don't have to change the parameters each time it runs. Thanks in advance for any help you can provide.

JLB2
 
DatePart will give you quarters, and also years. This can be based on the Currentdate.

What you've shown could be done by two separate Crosstabs - you find them under 'Insert'. If you want them on the same line, you could group by month and use a running total with a selection formula for each of the quarters and years you want to show.

If you're not already familiar with Crystal's automated totals, see FAQ767-6524.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
I followed your guidance and came up with the following formula after a little more research. The formula seems to work for the previous quarter but it seems like there should be a simpler way to write it. Here it is:

{Table.Field} in dateserial(year(DateAdd ("q", -1, currentdate)), (datepart("q",DateAdd ("q", -1, currentdate))*3)-2,1) to
dateserial(year(DateAdd ("q", -1, currentdate)), (datepart("q",DateAdd ("q", -1, currentdate))*3)+1,-1)
 
Easier if you compare years and quarters from the table field to their equivalents based on the current date. And write a formula field to see if something is selected.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top