CR5 : Counting distinct values withing a group

Posted on 2005-04-28
Medium Priority
Last Modified: 2008-02-01
I am using Crystal Reports 5 (old I know but I don't have a choice).

I have a report built this way :

-------------    -----------    -------------
   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.
Question by:Bicsln
  • 3
  • 3
LVL 101

Accepted Solution

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

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


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.

LVL 101

Expert Comment

ID: 13887006
Sorry, missed the version number.

Try this

Create a formula

If ({SampledField}) = 'Y' then

Do a summary on that field.

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.


Author Comment

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

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

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!
LVL 101

Expert Comment

ID: 13889454
The summary type would have been SUM

Glad i could help


Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question