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

Crystal grouping and while printing records 1

Status
Not open for further replies.

jchewsmith

Technical User
Nov 20, 2006
161
US
I have a report that first groups by customer then by month/year:

I need to do a count of the last 3 months but I need to reset it after a new customer

example:
abc co month 1 = 10 last 3 months = 10
month 2 - 5 last 3 months = 15
month 3 = 10 last 3 months = 25
month 4 = 7 last 3 months = 22

def co month 1 = 2 last 3 months = 2
month 2 = 6 last 3 months = 8
month 3 = 5 last 3 months = 13
month 4 = 7 last 3 months = 18

my formulas for month and 3 months look like this:
MONTH:
whileprintingrecords;
Global NumberVar M3;
Global NumberVar M2;
Global NumberVar M1;

M3 := M2;
M2 := M1;
M1 := Sum ({@countoflastlogin}, {ssi_Customers1.LastLogin}, "monthly");


3 MONTHS:
WhilePrintingRecords;
Global NumberVar M3;
Global NumberVar M2;
Global NumberVar M1;

M3 + M2 + M1
 
Not exactly clear on what you're trying to get to. Do you want totals by month including each of the last three months, or do you want the last three months rolled up while you do totals for other months individually?

If you want to do something like this:

Customer !
month 1 10
month 2 15
last 3 months 37

then you can incorporate a rollup into your month formula. I'll assume you already have formulas for the start and end date for your last 3 months. Then your month/year formula becomes:
if {date} in {@begin last2} to {@end last3}
then "Last 3 Months"
else totext({date},"yyyy/MM")

If you want each month (including the last 3 separate, then create a Running Total that is reset on change of group for the customer, and use an evaluate formula like: {date} in {@begin last3} to {@end last3}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top