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!

Date Add or?????

Status
Not open for further replies.

computerlady143

Technical User
Apr 2, 2008
38
US
I am comparing sales from last year to previous years but by month. Example - I have a spreadsheet where I manually entered the sales for every month for the year for all twelve months - Jan. 07 Feb 07 March 07, etc and on the send row I have Jan. 08 Feb 08 March 08 etc. I need a trigger or a formula that when I put a date range it will list the sales for the whole previous year month by month. Then automatically list the sales for the 2ND year month by month and of course if the future month has no sales as of that time it will list zero or be blank. Every time I run this report of course it will update the future months. I was looking at the Date Add, but open to whatever I need. I am assuming I will use a date range. If I want to compare the sales for 08 I assume I will use a date range 01-01-07-12-31-07 and then it will list those sales and then automatically list Jan 08, Feb 08, March 08, which I assume I will have 12 formula placed on the report. I thinking I will use the cross tab. The Layout will be something similar to this:

However the layout is not etched in stone. This is how I have it in Excel, however the layout can be changed



Customer Jan Feb March Total Sales % of Sales
ABC Tank
2007 1,000 5,000 3,000 9,000
2008 3,000 2,000 5,000 10,000
Ed Pawn
2007 1,000 3,000 4,000 8,000
2008 2,000 4,000 3,000 9,000


 
I forgot to mention I am using Crystal Reports ver 9. I came across this in my search on this forum. However, it doesn't work for me or I am doing something wrong???

If I write the formula like this:

Try DateAdd ("yyyy",-1,{?StartDate}) and DateAdd ("yyyy",-1,{?EndDate}) then I get the error then I get the error "a Boolean is required here". If I write the formula like Try DateAdd ("yyyy",-1,{StartDate}) and DateAdd ("yyyy",-1,{EndDate}) like stated in the post then I get the error the "field is not known ". Here is the link to the to the original posting which is trying to do what I want but I want it for all 12 months:

 
A boolean evaluates to true or false. The dateadd() function will return a date. So image a formula:

Somedate and Someotherdate

This does not not evaluate to true or false, hence the error. Try a formula like this, notice the red text for emphasis:

Code:
{YourDateField} [red]in[/red] DateAdd ("yyyy",-1,{?StartDate}) [red]to[/red] DateAdd ("yyyy",-1,{?EndDate})

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

"What version of URGENT!!! are you using?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top