×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Crystal grouping and while printing records

## Crystal grouping and while printing records

(OP)
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;

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

M3 + M2 + M1

### RE: Crystal grouping and while printing records

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}

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!