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

Data from Year to Date 2003 in 2004

Status
Not open for further replies.

steeplec

MIS
Jan 5, 2004
2
US
I'm having a problem getting records from 2003 to show up on my report. Here is the formula I'm using:

if Month (CurrentDate) = 1 and
{SW_CM_CASE.SWDATECREATED} in LastYearYTD
then 1
else if{SW_CM_CASE.SWDATECREATED} in YearToDate
then 1
else 0

What I want to do is if the date is Jan 2004 I want to count records opened in the year to date from the previous month for Dec 2003. If the month is Feb 2004, I want to count cases for Jan 2004.

Please help if anyone has any ideas on how to get around this.

Thanks.
 
Depending upon the version of Crystal, you could use the dateadd function:

{table.date} <= cdate(year(currentdate),month(currentdate),1)-1
and
{table.date} >= dateadd(&quot;yyyy&quot;,-1,cdate(year(currentdate),month(currentdate),1))

Something like that... Didn't test it though so it might need some minor tweak.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top