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

Compute a % on a "running total distinct count"

Status
Not open for further replies.

sgp_imported

Technical User
Sep 11, 2001
8
0
0
US
I summarized billing data group by date. Calculated a "running total distinct count" which works fine.

What I am trying to do now is to compute the cumulative % of distinct record count to the total record count.

Example:

DATE RT_Distinctcount % to total RT
09/01/01 1 (1/5)= 20%
09/04/01 2 (2/5)= 40%
09/05/01 3 (3/5)= 60%
09/06/01 4 (4/5)= 80%
09/10/01 5 (5/5)= 100%

Anyone's suggestion will be appreciated!

Thank you!
 
mOrgan,

Your problems lie where the running total gets evaluated when the report runs. Crystal Reports uses a "3 pass" system to create a report. Different aspects of the report are evaluated in one of the three passes.

Running totals are evaluated on the 2nd pass - but you also need the total to calculate the percentage. Write a formula that calculates the percentage of each record against the total, declare a global numbervar to store the previous percentage, and add the new percentage to it.
Make sure to initialise the variable back to zero at the start of each group. The first line should also contain "WhilePrintingRecords" to force it to be evaluated at the end of 2nd pass.

Hope this helps.

paulmarr@arcom.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top