Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: counting records formula Post Reply Post New Topic
Author Message
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Topic: counting records formula
    Posted: 28 Jan 2013 at 12:58pm
hello,
 
I have a report where I am listing all principal diagnosis. I have a formula which counts if the clients have a specific diagnosis.
 
formula:
if ({history_diagnosis.axis_I_diag_code_1} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_2} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_3} startswith ["291","292","303","304","305"]
or{history_diagnosis.axis_I_diag_code_4} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_5} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_6} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_7} startswith ["291","292","303","304","305"]
or{history_diagnosis.axis_I_diag_code_8} startswith ["291","292","303","304","305"])
then 1 else 0
 
now i get a 1.00 if the client has one of the above diagnosis. I can do a sum on this formula however if a client was open to multiple programs and has one of the above diagnosis for those programs the client is displayed twice and counted twice. if the client is listed more than once i just want to count the client once.
 
I tried a running total and that did not work
I tried doing a distinct count on client_id however this only gives me a distinct number of clients regardless if they meet the above diagnosis.
 
help
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 28 Jan 2013 at 5:50pm
Hi

You add some condition to your distinct count like :

If {@formula} > 0 Then Distinctcount({Client})

or

Insert a group on Client, insert summary on you group footer.  This will give you 0, 1 or more than 1, now you write one more formula like :

If sum({@formula},{Client}) > 0 then 1 else 0

Now you can insert a summary on the above formula

 
Thanks,
Sastry
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Jan 2013 at 4:11am
or use a running total to do a distinct count of the clientid with an evaluation formula as
({history_diagnosis.axis_I_diag_code_1} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_2} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_3} startswith ["291","292","303","304","305"]
or{history_diagnosis.axis_I_diag_code_4} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_5} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_6} startswith ["291","292","303","304","305"]
or {history_diagnosis.axis_I_diag_code_7} startswith ["291","292","303","304","305"]
or{history_diagnosis.axis_I_diag_code_8} startswith ["291","292","303","304","305"])
reset=never
make sure to set the formula editor to use defualt values fo null
IP IP Logged
sanchezgmc06
Senior Member
Senior Member
Avatar

Joined: 21 Jan 2011
Online Status: Offline
Posts: 107
Quote sanchezgmc06 Replybullet Posted: 31 Jan 2013 at 8:25am
thank you (it worked) Thumbs%20Up
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.