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 ranges in sales

Status
Not open for further replies.

kris0517

Vendor
May 13, 2003
6
IN
I just took a crash course on crystal reports in a recent class and have a basic working knowledge on writing reports without going into too much detail. I thought i could figure this out but it is driving me crazy. This is my question.

I want to report on the total amount of gross sales for specific customers between May 12, 2001 to May 12, 2002.
Then do total amount of gross sales for the same customers between May 12, 2002 to May 12, 2003.

I could just do year to date sales for the latter part, but what of last years? i'm going crazy!

please help!!!

thank you
 
Select the data for both years, and group by the year.

To elaborate:

(Report->Edit Selection Formula->Record)

{Table.datefield} >= cdate(2001,5,12)
and
{Table.datefield} <= cdate(2003,5,12)

Generally you would exclude the 12 the the begining or the end of the range.

To group by the year:

Insert->Group->Select your date->Change the Section Will Be Printed to: For Each Year

Place the sales field in the details, right click it and select Insert Summary->Sum

-l
 
Or you could do this as a manual crosstab report. If you wanted to go two years previously from the current date (so that the years don't necessarily correspond to calendar years), then for your record select use something like:

{sales.date} in Dateadd(&quot;yyyy&quot;,-2,Currentdate) to Currentdate

Then create two formulas {@YearOne}:

if (sales.date} in Dateadd(&quot;yyyy&quot;,-2,Currentdate) to Dateadd(&quot;yyyy&quot;,-1,Currentdate) then {sales.amt}

For {@YearTwo}:

if (sales.date} in Dateadd(&quot;yyyy&quot;,-1,Currentdate) to Currentdate then {sales.amt}

Place these in the detail section. Create a group on {salesman} and insert summaries on the two formulas above at the group level. You can drag the summaries to the group header and then suppress the detail section.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top