Showing results for 
Search instead for 
Did you mean: 

Only patients with a certain diagnosis

0 Kudos

I have a report where the patient may have a list of different diagnoses. I want to eliminate patients that have a certain diagnosis. I tried not like, not in from select expert and section expert using the suppress formula but all this does is eliminate the diagnosis from the list but still shows the patient. Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor

This type of thing can be a challenge if you're just linking tables together in Crystal. How are your SQL skills? I recommend creating a Command (SQL Select statement) that get's all of the data for the report and has something like the following in the where clause:

and not exists (
   Select 'X' from patient_diagnosis where diagnosis_id = '123A' and patient_id = patient.patient_id

This will filter out from the data all of the patients that have that diagnosis as one of their codes.

For more information about using Commands see the blog post here. If you're not sure how to write the query, you can go to the Database menu in Crystal and select "Show SQL Query...". Copy the contents of the window and paste them here. Also provide the formula from the Select Expert and the type of database you're connecting to. I should be able to provide you with a query that is based on that information to get you started.


Answers (1)

Answers (1)

Active Contributor
0 Kudos

Group the report on Patient.

Create a formula DiagX:
IF Diag = 'X' Then 1 Else 0

Add a formula to compute the MAX of that formula for each patient.

Add a Group Selection Formula that ensures that MAX = 0