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!

Need To Create Box That Shows Previous Month Label And Amount Of Sales

Status
Not open for further replies.

Repent34

IS-IT--Management
Jan 9, 2008
13
US
I am using CR2008

I am creating a report for our salesmen and one of the fields in the report will be a text box that shows what the last month was. For instance, if the report is run this month, the report will plug July 2011 into the box because that was what last month was. Tied to this will be a salesman's total sales for last month that should show up in a box. I will place this box right next to the salesman's name on the report as the names will be static.

I have several of these to do and if I can see the method I can re-create it for the others.

How would I do this?
 
If you don't need any data from this month, try this:

1. Group by salesman.
2. Create a formula for the beginning of last month that will look something like this (I'll call it {@StartDate}):
Code:
numbervar lmMonth := Month(dateadd('m', -1, currentdate));
numbervar lmYear := Year(dateadd('m', -1, currendate));
Date(lmYear, lmMonth, 1)
3. Create a formula for the end of last month that will look something like this (I'll call it {@EndDate}):
Code:
numbervar curMonth := Month(currentdate);
numberval curYear := Year(currendate);
Date(curYear, curMonth, 1) - 1
4. In the Select Expert, edit the formula and add something like this: {table.DateField} in ({@StartDate} to {@EndDate})
5. Put your data in the salesman group header and include a summary that adds the sales from the data.

If you need to have the current month's data in addition to the previous month's, you'll have to either write a command that will gather all of the data for the report and handle all of the calculations or use a subreport to get the data for one of the months.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Thank you Hilfy for taking the time to help me. This is very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top