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!

Help with previous month total

Status
Not open for further replies.
Dec 31, 2004
71
GB
Hi All,
I have an issue that has occured after the change from 2010 to 2011.

I have a formula that counts values where the month -1 = the previous month

i.e:
if {@MonthFromDate}-1 = {@MonthofClosure}
then 1
else 0

This works well for the year 2010 but when the report was run in jan the result was blank because 1 - 1 = 0

I want to set something up to account for the above issue.

Any help will be much apprecioated

Thanks
 
Use DateAdd, you can subtract a whole month.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
To be more exact, you can take the original date, subtract a month and then get the month number.

You'll also need to allow for year once you get a couple of year's worth of data.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Thanks

I have created the below formulas:-

//PrevMonth
DateAdd ("m", -1, {?Pm-@par From Date})

//prev month formula
if month({@previous month}) = {@Monthofclosure}
and year(CurrentDate) = {@Yearofrecord}
and not({@exclusionformula})
then 1
else 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top