Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Not sure how to do this count (distinctcount???) Post Reply Post New Topic
Author Message
MIKE-CHECKA
Newbie
Newbie


Joined: 30 Aug 2011
Online Status: Offline
Posts: 2
Quote MIKE-CHECKA Replybullet Topic: Not sure how to do this count (distinctcount???)
     Posted: 30 Aug 2011 at 8:17am
I'm working with a medical DB and I need to get a count of patients who had more than one exam in one day. I'm not sure that I can use distinctcount to get this because it sort of distinct. Some of the fields I was trying to use were the PatientID, ExamID, and of course ExamDate. Anyone have any thought on how I can do this? Your help is appreciated.

Thanks you,
Mike
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Aug 2011 at 10:42am
one way...
group on patient
group on exam date set to day
insert a summary as a count of patientid on group2 (day)
insert a running total
name=count_of_multi_day (or whatever)
field to summarize = patientid
type = distinctcount
evaluate= use a formula
Count ({table.patientid}, {table.examdate}, "daily")>1
reset=never
place in report footer
IP IP Logged
MIKE-CHECKA
Newbie
Newbie


Joined: 30 Aug 2011
Online Status: Offline
Posts: 2
Quote MIKE-CHECKA Replybullet Posted: 04 Nov 2011 at 10:48am
DBlank,

Sorry I haven't gotten back to you sooner. I really appreciate your help. I had to put this on hold for a while. So once I followed your directions to a T, I get it to work. The problem is I am doing this for a date range and it looks like crystal comes to the first date that has multi-exams and that's the number it outputs (is the grouping daily causing this?). I'm not sure how I can use the running total to add them together for each day in the range. Thanks again for your help.

Mike
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Nov 2011 at 5:36am
I understood your requirement to give you a count of patients
but you want a to count each instance per patient?
make a formula field to concantenate the patient with the date field called "patient_and_day" (or whatever you want)
//I am guessing you have a numeric patient id here
totext({table.patientid},0,"") + totext({table.date},"(MM/dd/yyyy)")
use the result as teh field to summarize in your RT
 
name=count_of_multi_day (or whatever)
field to summarize = @patient_and_day
type = distinctcount
evaluate= use a formula
Count ({table.patientid}, {table.examdate}, "daily")>1
reset=never


Edited by DBlank - 07 Nov 2011 at 5:36am
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