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

Running Totals

Status
Not open for further replies.

jason8643

MIS
May 28, 2003
7
US
Is it possible to divide a running total in the report footer by a running total in a group footer? Pardon my simple illustration.

GH1 - Surpressed (Grouped by months)
D - {Acct.num}
GF1 - Count of Acct Numbers
RF - Grand Total of Acct Numbers

I'm trying to divide the numbers of accounts in each group by the grand total in the report footer. I've tried everything from the EvaluateAfter function, to creating a shared numbervar and placing it in the header, nothing seems to work. Is there some way of making crystal run through the data first before evaluating a certain formula or running total.

THANKS!!
 
Use a conventional right click the field and use Insert->Summary->Count and select a for all groups and a grand total and you can then reference the grand total in GF1.

-k
 
If you must use running totals, then you need to create a new running total to capture the Group 1 value at the report footer level. For {#July}, select {table.acctno}, count, evaluate based on a formula, e.g.:

month({table.date}) = 7 //or however you are defining instances of your group

Reset never.

Place this in the report footer and/or use in a formula:

{#July}/{#Year}

-LB
 


Yes it is possible, but you can't do it with the stock summary functions. You will have to create your own functions.

//place this function in your group header (suppressed)
function: init_group_count

whileprintingrecords;
shared numbervar g_count := 0;


//place this function in your group details (suppressed)
function: inc_group_count

whileprintingrecords;
shared numbervar g_count;
g_count := g_count+1; // or add a field, or whatever


//place this function in you group footer section (visible)
function: Disp_group_count

whileprintingrecords;
shared numbervar g_count;
g_count;



Create three more functions for the total count and place the init function in the report header, the increment function in the details (or in the group footer and add the footer total to the grand total) and finally put the grand total in the report footer.

Finally create another function that takes the group totals and divides them by the grand total.
 
Can you clarify your question please?
Are you suming up the value in each record and creating a grand total (in the RF) and then dividing by the total number of accounts? In that case you want an average amount by account?

Or is it more complex.

Howard Hammerman,
Crystal Training and Crystal Material
On-site and public classes
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269
 
My report is grouped by months, and the number of accounts populate that grouping by their open date. At the report footer I have a grand total of all the accounts opened based on the date parameter selection.

My question is how could I divide the number of accounts in any given month by the grand total of all accounts opened for the date selection of the report. Crystal doesn't evaluate all the data first before it compiles the division function referenced above.

I hope this makes more sense.
 
My solution should work. Did you try it?

-LB
 
lbass

I believe your solution would work, however the result needs to be placed in each group footer as the result would change based on the month grouping. Crystal would have to analyze the total in the group footer and divide that number by the totals in the group footers. The final result is simply a percentage of the report footer total and the group footers total. Does this make more sense?

jason8643
 
I think you are missing the point of my earlier suggestion.
Each running total would have an evaluation formula specifying the particular month, but would never be reset. This means, for example, that the running total for July would keep its value through December. You would have to place it in the report footer and also place the formula dividing by the grand total in the report footer. You would use text boxes to describe each month as follows:

Month Total % of Annual Total
Jan: 20 10.0%
Feb: 10 5.0%
!
!
!
Dec: 5 2.5%
2002 200 100.0%

The issue is whether you are willing to display the results in the report footer like this, or whether you want to keep them in the group footer for each month.

If you cannot use regular summaries or conditional formulas instead of running totals then the only other solution I think would be to create an unlinked subreport which calculates the report total and then bring that into the group footer of the main report as a shared variable so you can do the calculation in the main report.

-LB
 
I have created an report for employee master and details.
and grouped on Employee id. Number of Details for any employee are not decide. If any employee have 4 details but
that employee group is showing in 2nd page but its details is showing in 3rd page. I want to display this Employee and master in same page.

 
jason8643

after reading ur post and replies. I believe that if you approched from the viewpoint of math. you can solve problem easly if you have not already. In your report footer you can create text boxes for your other answers and for controls simply use the approch =[text1]/[text2]. same as you would on paper. [text1] and [text2] here denote format. the actual name is the ones in your report. this way it does not matter, the example will always crunch the numbers which appear in the other text boxes which you want to crunch. good luck :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top