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

Conditional group summary help 1

Status
Not open for further replies.

ciscowiz

MIS
Apr 21, 2004
146
US
I have a report showing amounts for payments and a column if they have been deleted or not. I need to take the sum of the amounts but only if it is not deleted, or a '0'. The report groups the data by credit card so each different credit card has its own group total.

I figured out how to get the correct final total for the end of the report but i cant figure out how to do the conditional sum for the group total. Could someone please show me how to do conditional group summary? Right now it is just adding all the amounts for the group, regardless of deleted column.

Thanks!
 
Create a Running Total and in the evaluate->Use a Formula place something like:

{table.deleted} = true

Or whatever the deleted flag is, not sharing such info makes it difficult to assist you.

Set the Group by to the credit card field and place it in the credit card group footer.

Now go into the Report->Edit Selection Formula->Group and place something like:

sum({table.amount},{table.creditcard}) > 0

It's generally a good idea to include technical info when requesting it:

Crystal version
Datbase/connectivity used
Example data
Expected output

-k
 
Or you could create a detail level formula:

if {table.deleted} = "Y" then {table.payment}

Then right click on the formula and insert a summary.

-LB
 
How do you create a running total? Can you be more specific please? Is it like Inserting a summary?

The deleted column is either a 1 or a 0, 1 being deleted, and the associated amount should not be included in the group total or final total. I am using CR9. The report is grouped by payment type ie cash, check, visa. For each type, it starts on a new page and has its own total. I need this total to only consist of the amounts where the deleted column is a zero.

I figured out how to get the correct grand total by using a formula like
If table.deleted = "0" then table.amount

then i made another formula that used Sum() to sum the first formula. This only produces the grand total even if i place it in the group footer, the total is always the grand total. I am just looking to sum the different group members amounts that have a zero in the deleted column.
THANKS!
 
Do you know what version of Crystal you have? How you create them is based on this, something you should always include with a post. Try hitting F1 and typing Running Total into the search...

Anyway, in the Field Explorer you'll see Running Total, right click it and select New.

To use LB's approach, you'd use the 3 formula method:

Group header formula:
whileprintingrecords;
numbervar MySum:=0;

Details formula:
whileprintingrecords;
numbervar MySum;
if {table.deleted} = 0 then
MySum:=Mysum+{table.payment}

Group Footer:
whileprintingrecords;
numbervar MySum

-k
 
I don't know why you would need a running total. All you really need to do is right click on the formula you used for inserting the grand total:

If table.deleted = "0" then table.amount

...and instead of choosing "insert grand total", choose "insert summary". Then check "insert summary for all groups".

-LB
 
I created used the formula if table.deleted = "0" then table.amount and from there did an insert summary based on the formula. This worked perfectly thanks guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top