Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: distinctcount functionality appears to be buggy Post Reply Post New Topic
Author Message
Paul Mecham
Newbie
Newbie
Avatar

Joined: 12 Jan 2009
Location: United States
Online Status: Offline
Posts: 2
Quote Paul Mecham Replybullet Topic: distinctcount functionality appears to be buggy
     Posted: 13 Jan 2009 at 7:15am

Hello everyone, I'm using Crystal Reports XI and I'm trying to get a simple count of some records using the distinctcount function.  It appears as though crystal reports is not counting a distinct item when it's at the end of the returned dataset.  I have three rows of episodeid columns like this:

1

2

3

And the disctinctcount functon returns 2 instead of 3 as it would with the sql query select count(distinct(episodeid)).
 
Is there any way to make crystal reports count this last item?  I've tried using a running total field and it returns the same erroneous (from my point of view) results.  It appears to have to do with the cursor being at the end of the record set.  It appears to fail to count that last value because there is no additional distinct row value to trigger the count addition.
 
I've also tried using an sql epression field witht he parened value and it works but then I can't pass through my report parameters. 
 
I'm going to try a subreport next but it seems like that's a lot to do for such a simple need.
 
Any help would be appreciated.
 
Paul
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2009 at 8:01am
I have not has this problem before. My experience with count problems generally has to with me choosing the wrong field to summarize or my forgetting how the grouping is handling it.
You have "episodeid" field placed on your details section and you are doing a summary as a distinct count of "episodeid" at the group footer, not a distict count of another field on the details section, correct?
IP IP Logged
Paul Mecham
Newbie
Newbie
Avatar

Joined: 12 Jan 2009
Location: United States
Online Status: Offline
Posts: 2
Quote Paul Mecham Replybullet Posted: 13 Jan 2009 at 10:14am
No I'm actually doing a distinct count on the report footer.  I never reset the value for the field and am just attempting to do a summary the distinct episode id's.  I'm telling the running total field to "evaulate" when the episode_id changes and it seems to be missing the last "evaluate" action.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Jan 2009 at 10:23am
easiest solution is to skip the running total and use a summary.
click on your Episodeid field, click on the Insert Summary function,
verify your field is in the "Choose the field to Summarize", "calculate the summary" as Distinct Count and the "summary location" should be Grand Total (report footer).
If you want to use the running total, for the circumstances you described set the Evaluate at "For each record" and the Reset to "Never".
It will give you the same number as the Summary function. Smile


Edited by DBlank - 13 Jan 2009 at 10:56am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum