Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Exclude duplicate records from count Post Reply Post New Topic
Author Message
crystalnewbie33
Newbie
Newbie


Joined: 08 Jan 2014
Online Status: Offline
Posts: 29
Quote crystalnewbie33 Replybullet Topic: Exclude duplicate records from count
     Posted: 17 Sep 2014 at 8:08am
I've looked through the forums and can't find this answer (probably because it is too simple). I want to count the # of customers from a sales db but there are multiple records for each customer. I have tried to suppress duplicate customers but have found that the count function still includes the suppressed records. So if I have 100 records but only 20 customers, count {sales.customer} produces a result of 100. What is the simplest way to get a count of customers here? I intend to use this as a subreport in another report just to show the # of customers at the top so the report doesn't need anything else in it.
IP IP Logged
crystalnewbie33
Newbie
Newbie


Joined: 08 Jan 2014
Online Status: Offline
Posts: 29
Quote crystalnewbie33 Replybullet Posted: 17 Sep 2014 at 9:10am
I think I found a solution. Instead of a count, I used distinctcount{sales.customer} and produced the correct results. Any other ideas/solutions? Or reasons to not use distinct count? Any input is appreciated.

Edited by crystalnewbie33 - 17 Sep 2014 at 9:11am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Sep 2014 at 9:15am
distinctcount is the simplest approach.
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