Solved

# CR5 : Counting distinct values withing a group

Posted on 2005-04-28
Medium Priority
574 Views
I am using Crystal Reports 5 (old I know but I don't have a choice).

I have a report built this way :

CONTRACT    SAMPLED         DATE
-------------    -----------    -------------
0001               N           2005-04-26
0001               Y           2005-04-26
0001               N           2005-04-27
0001               Y           2005-04-28
0001               N           2005-04-29

A page break will occur after the last line since I am grouping on the CONTRACT field. What I need to do is summarize the SAMPLED field and tell the user how many records have "Y" as a value. In this case I would be showing "2".

Is there a simple way of doing this?

Thank you.
0
Question by:Bicsln
• 3
• 3

LVL 101

Accepted Solution

mlmcc earned 400 total points
ID: 13886883
Use a running total

Click INSERT --> RUNNING TOTAL
Click NEW (right click)
Name - YCount
Type - Count
Field - Sampled Field
Evaluate - Use a formula
{SampledField} = 'Y'
Reset - On group change

mlmcc
0

Author Comment

ID: 13886964
Unfortunately version 5 doesn't have that functionality. According to the help system I can add running totals but I must create them from scratch using formulas. Any idea how I should be tackling this?

I checked in the INSERT menu and there are no mentions of a running total.

Thanks.
0

LVL 101

Expert Comment

ID: 13887006
Sorry, missed the version number.

Try this

Create a formula

If ({SampledField}) = 'Y' then
1
else
0

Do a summary on that field.

mlmcc
0

Author Comment

ID: 13887107
What kind of summary? Count? average? Distinct count?

Sorry but I am a total noob when it comes to CR.
0

Author Comment

ID: 13887171
I managed to do it using your first suggestion :

1. Created a formula in the group header to initialize a counter.
2. Created a formula in the group itself to add 1 to the counter when my value was "Y".
3. Created a formula in the group footer to show the value of the counter.

Thanks a lot!
0

LVL 101

Expert Comment

ID: 13889454
The summary type would have been SUM

mlmcc
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
###### Suggested Courses
Course of the Month17 days, 2 hours left to enroll