cancel
Showing results for 
Search instead for 
Did you mean: 

Running Total - Evaluating on Both 'Change of Group' and Formula

Former Member
0 Kudos

Hi,

I am trying to create a running total that needs to evaluate on "Change of Group 3" and also filter results using a formula. My formula is {@GroupingName = 'Location'}, where I have multiple running total fields to calculate each location. How can I accomplish this? Can I write a formula that will allow me to evaluate on the change of group and also filter results by name. Thanks.

Edited by: AMD_GAMER on Apr 21, 2010 8:12 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

use manual running totals- wizard is buggy sometimes

create 3 formulas

reset --- goes in group header

whileprintingrecords;

numbervar x := 0;

calc goes next to what is being calcualted

whileprintingrecords;

numbervar x := x + {field or formula};

display goes where you would like the value to show

whileprintingrecords;

numbervar x;

x

Former Member
0 Kudos

Thanks. That would work for a normal running total. What is the crystal syntax for specifying "On Change of Group." I need to sum $$$ amounts based on a Service_ID. I used your code but received the same total amount as when I used the built in running total.

Former Member
0 Kudos

the change of group is actually your reset formula

so you place that in the group header to reset the value to zero each time a new value or change of group comes up

the calc gets placed next to what is being calcualted

the display goes in the footer of where the reset is placed

if you need to total more than one group or field you need to create set of the 3 formulas for each

Former Member
0 Kudos

Thanks. I understand the logic of the formulas and the location of them in the report. However, I can't reset the value on grouping change, but actually it needs to "evaluate" on the change of service_ID. The service_ID is currently Group 3 in my report.

Ex:

Service ID 111 - Charge $100

Service ID 111 - Charge $100

Service ID 222 - Charge $200

The total would need to show $300, since I need to evaluate service_ID 111 for $100 and add that to the service_ID 222 for $200. Showing a total of $400 would be wrong. Its a very complex report that I am modifying to get totals by location.

Former Member
0 Kudos

it is not complex at all

create a group for service id

place your reset in the group header ( a group header display a unique value for each one it hits)

insert a section below that group now you have a 2nd group for service id

place the calc in there

place the display in the footer.

surpress the 2nd group and the reset formula and if you try it it works

Former Member
0 Kudos

I was able to get the running total to work, by "evaluate on formula" and using the following formula:

{vwGenSvcInfo.Location_Abbr} = 'LocationAbbreviation' and

Next({vwGenSvcInfo.Service_ID})<>{vwGenSvcInfo.Service_ID}

This code works for all groups except the last group. I am missing the very last record of that group. I am guessing this is occurring since it is the last record. How can I write the code to check if it is the last record and to make sure the amount is counted. The field that needs to be totaled is a formula called {@Chg Amt.}

Former Member
0 Kudos

I figured it out. I had to set the formula for "Default Values for Nulls."

Answers (0)