Excluding Entire Group if combination of values

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Good Morning all,

I am currently working on a crystal report that groups by patient account number. Under the group, the detail has charge code number. I am trying to exclude or suppress any patient account number that has both charges code numbers 87 and 89. The patient would have to have both 87 and 89 to be excluded, if the patient has only 87 or only 89 then the patient will still show in report. Please see below for an example

Patient155

89

81

83

87

80

Patient 156

87

80

81

Patient 157

87

89

80

82

In this example I would like to only exclude Patient 157 because all though Patient 155 and Patient 156 have either 87 or 89, Patient 157 has both charge code 87 and 89.

Please help.

Thank you
create two 'flags' for your inclusion computation criteria

//flag87
if chargecode = 87 then 1
//flag89
if chargecode = 89 then 1

sum both of these at the client group level
use the result of both to exclude your group via group select criteria
NOT(SUM(@flag87,clientid)>0 and SUM(@flag89,clientid)>0)

Note group excluded items are still include in summary calculations so if you are doing other calculation you would need to make sure your conditions exclude them or use Running Totals.

Edited by DBlank - 16 Mar 2017 at 4:20am