Print Page | Close Window

Count if highlighted or other criteria

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22456
Printed Date: 28 Apr 2024 at 5:47pm


Topic: Count if highlighted or other criteria
Posted By: Andrewarbogast
Subject: Count if highlighted or other criteria
Date Posted: 19 Sep 2017 at 3:44am
So I'm trying to get counts of specific criteria and the totals are not working.
The criteria are:

count {field} if it says MHA Missing
count {field} if it's highlighted yellow
count {field} if it's >=2.999

any ideas?
Thanks



Replies:
Posted By: Andrewarbogast
Date Posted: 19 Sep 2017 at 4:14am
So I was able to get some totals based on summing formulas like:

If{@New MHA order}="MHA Missing" Then 1 else 0

if{@datediff 2}>=2.5
and{@datediff 2}<=2.998 then 1 else 0

running total for >=3
evaluate - on change of group
rest - never

I created parameters to select clinicians which range from 1 - 259 clinicians. I tested the totals for 1 clinician and 2 clinicians but when I select all clinicians and export it to excel and compare the totals they don't match except for client count.

Client count = 6522
Missing MHA = 968 (excel 845)
Due Date Approaching = 531 (excel 385)
MHA Update Due = 480 (excel 478)

Please help!


Posted By: Andrewarbogast
Date Posted: 19 Sep 2017 at 8:51am
New update:
The totals are counting suppressed data. What I'm confused about is there's no fields in my suppressed sections. When I put the "clinician" field in the details section, I see that there are multiple clinicians attached to the client which I'm guessing is where these totals are being skewed.

Is there a way to ignore suppressed data?


Posted By: kevlray
Date Posted: 19 Sep 2017 at 10:24am
Just because something suppressed in CR, it is still there.  If you do not want it to count then that same criteria needs to be in your running total (or formula is you are going that route).


Posted By: Andrewarbogast
Date Posted: 20 Sep 2017 at 3:03am
So I suppressed my details section by right clicking and suppressing in Design. For my totals, I have two summaries and a running total:
If{@New MHA order}="MHA Missing" Then 1 else 0

if{@datediff 2}>=2.5
and{@datediff 2}<=2.998 then 1 else 0

running total for {@>=3}
evaluate - on change of group (group #1 PATID)
reset - never

Is there a way to ignore suppressed data in these formulas?
Thanks


Posted By: kevlray
Date Posted: 20 Sep 2017 at 3:54am
What is the criteria for not including a value in a running total?  That will have to be included in the formula so that the running total does not happen.


Posted By: Andrewarbogast
Date Posted: 20 Sep 2017 at 5:10am
I don't have a criteria. Right now I'm doing formulas like:
if{@datediff 2}>=3 then 1 else 0

and then I do a sum of that in my running total.


Posted By: kevlray
Date Posted: 20 Sep 2017 at 9:03am
Again, just remember that suppressing a field, group, etc. does not remove it from the report, just hides it.

So running totals have to set up so that you are only counting what you want, not what you see.


Posted By: DBlank
Date Posted: 21 Sep 2017 at 2:48am
kevlray is absolutely correct, don't confuse data visibility with its existence and the inclusion of it in summary data.
Since you are using Running totals, just use the distinct count on your patient id using your criteria not a "1 or 0" result sum.



Print Page | Close Window