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

YTD and LYTD formulas give same values

Status
Not open for further replies.

kagee

Programmer
Apr 21, 2004
30
NL
Hi,

Am using crystal 10 with SQL server 2000. My sequel view returns all the data i need for both current financial yr and Previous financial yr.
(Date, AccountNo, AccountDesc, Amounts)

The financial year spans Sept 2004 to August 2005, with reporting being sept 2004 to date

Problem @ Hand:
Both the YTD formula and LYTD formula are returning same value (YTD amount) but the values in the database are different.


Ps: Currently am using a record selection formula, 2 parameters and 2 formulas.

{?sdate} = parameter name of start date
{?edate} = parameter name of end date

My record selection formulas are...

{table.date} in date(year({?sdate),month({?sdate}),1) to {?edate}

.. and my formulas are:(put in the details sections)

@YTD
if {table.date} in {?Sdate} to {?Edate} then {table.amount} else 0

@LYTD
if {table.date) in dateadd("y",-1,{?Sdate}) to dateadd("y",-1,{?Edate}) then {table.amount} else 0

Please assist!
 
FYI, list of valid intervak arguments for dateadd() function:

yyyy - Year
q - Quarter (3-month period)
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week (7-day period)
h - Hour
n - Minute
s - Second



Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Thanks guys,

i actually discovered that my record selection formula was discarding previous yr records - i modified this plus the 'y' problem and now it works like cheese ...

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top