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

distinct count 1

Status
Not open for further replies.

a112

Programmer
Jul 3, 2001
10
US
In a Distinct Count, can you have a Subtotal based on a distinct Count,and a Grandtotal from a distinct count.

thanks a112
 
You can distinct count a group (subtotal) or you can distinct count an entire column (grand total). You cannot summarize the distinct count itself, unless you create a running total using variables.

See the FAQ on running totals and use the 3-formula technique. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
CAN YOU SHOW ME AN EXAMPLE USING RUNNING TOTALS AND THE 3-FORMULA TECHNIQUE. I'M USING A FIELD NAMED MEMBERID IN WHICH IT MAY APPEAR MORE THAN ONCE. I NEED TO DO A DISTINCT COUNT SHOWING SUBTOTALS AND A GRANDTOTAL AT THE END OF REPORT. THANKS A MILLION. a112.
 
Posting in UPPER CASE is harder to read.

Let me see if this is what you want.
You want a distinct count of each group.
Then you want a grand total that sums the distinct counts?

What is your group field. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Posting in UPPER CASE is harder to read.

Let me see if this is what you want.
You want a distinct count of each group.
Then you want a grand total that sums the distinct counts?

What is your group field.
Ken Hamady

Ken

The group field is by {Vdnt.MEMBERNAME}. This group field name is associate with the field {vdnt.MEMBERID}in which this field contains duplicate values.

Below are the formulas that I'm using. I need the a formula to do the comparison,a DistinctCount on MEMBERID FIELD as well as do the subtotaling and Grandtotaling (overall). The use of the formulas is to speed up report processing. using the Running Totals Expert Takes forever to process the report. Ken Can you shed some light? Thanks in Advance.

@Initialize formula #1

WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal:= 0

@Evaluate formula #2

WhilePrintingRecords;
NumberVar RunningTotal;
If (OnFirstRecord or {vdnt.MEMBERID}<>
Previous ({vdnt.MEMBERID})) then
RunningTotal:= RunningTotal + 1;

@Display formula #3

WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal;


 
I would use a different approach. Use a simple summary field to get the distinct count for each group.

To total these summary fields as a grand total, put the following formula on the group footer:

WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal:= RunningTotal +
DistinctCount( {vdnt.MEMBERID} , {Vdnt.MEMBERNAME} )

Put your &quot;display&quot; formula on the report footer. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top