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

COUNT/SUM A FORMULA FOR GROUPED LINES

Status
Not open for further replies.

OLTU

Technical User
Feb 14, 2005
39
NL
Hi All,

I'm using a crystal reports version 8.5

Is it possible to count/sum a formula when you have grouped
the lines/records.

As example

Group #Names: Pcs @Formula(worked with if then else)
Mercedes 15 8 new cars 7 old cars
Bmw 20 10 new cars 10 old cars
Audi 25 18 new cars 7 old cars
Mustang 30 15 new cars 15 old cars
Ferrari 35 28 new cars 7 old cars

Grnd total 125 cars Grndtotal new???? Grndtotal Old???

I need the grandtotal for my formulas for old and new cars.

Pls help!!!!!!!!!!!!!
appreciated for any help.

Thanks,
MHP
 
try something like this in a formula field

whileprintingrecords;
numbervar NewCars:=0
if Your Condition Check for New Cars = true then
NewCars := NewCars + 1

then simply subtract this from the grand total to get the other value



Mo
 
If you were able to insert a summary at the group level, you should also be able to insert a grand total on the formula.

-LB
 
I guess that the summary at group level was obtained with the if statement

on second thought I would use running total

whats in the @Formula(worked with if then else)???

that could help us help you.


Mo
 
MisterMo,

It works thanks,
but now I need only the last of your runningtotal like below,

Group #Names: Pcs @Formula YOUR SOLUTION
Mercedes 15 8 new cars 8
Bmw 20 10 new cars 18
Audi 25 18 new cars 36
Mustang 30 15 new cars 66
Ferrari 35 28 new cars 101

Groupfooter#: Grnd total 125 cars Grndtotal new????

But now I need only the 101 as my grnd tot on Group Footer and suppres the rest details.
 
My @formula

IF {car.name} STARTSWITH ["1996-2000","1996-2000","1996-2000"] then Sum (car.name}, {shop.id})/12 ELSE
IF {car.name} STARTSWITH ["2001-2005","2001-2005"] THEN Sum (car.name}, {shop.id)/24 ELSE
Sum (car.name}, {shop.id})
 
MISTERMO,
ANY NEWS??????????
 
If you make your initial formulas:

//{@old}:
IF {car.name} STARTSWITH "1996-2000" then 1

//{@new}:
IF {car.name} STARTSWITH "2001-2005" THEN 1

...and then right click on these formulas and insert a summary (SUM, not count) at group and grand total levels, do you get the correct figures? If not, please show a sample of your detail level data.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top