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

Percentage based on Group Distinct Count

Status
Not open for further replies.

Doreen9

Technical User
Oct 17, 2003
2
US
I have used a formula I found here to obtain a grand total of groups with distinct counts. It is a running total.. formula was:
//WhilePrintingRecords;NumberVar RunningTotal;RunningTotal:= RunningTotal + DistinctCount( {vdnt.MEMBERID} , {Vdnt.MEMBERNAME} )

It was necessary to do it this way because some of the same ID numbers are in different member groups..

Works like a charm except I can't get it to give me the total in the report footer. I can work around that if I have to.

My problem now is that I have to calculate the percent of grand total for each group distinct count .. so if the running total is 100 and the group total is 25 the percent would appear as .25 .. any ideas?

 
You need a separate formula for the report footer to display the result:

whileprintingrecords;
numbervar RunningTotal;

Because you are using running totals, you will have to save the report under another name and insert it as a subreport in the report header of the original report. In the report footer of the subreport, add a formula like this:

whileprintingrecords;
numbervar RunningTotal;
shared numbervar GT := RunningTotal;

You can then reference this in the main report group footers to create the percentage:

whileprintingrecords;
shared numbervar GT;
DistinctCount({vdnt.MEMBERID},{Vdnt.MEMBERNAME})%GT

To make the subreport in the report header disappear, suppress all sections WITHIN the subreport, and format the subreport itself->format subreport->subreport tab->check "suppress blank subreport". If you want the report header section to disappear (assuming there is nothing else in it--it could be a RH_b section, if you wish), format the section to "suppress blank section". You cannot suppress or hide the section or suppress the subreport object directly, if you want to share variables.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top