09-27-2018 6:26 PM
I need to sum by site, by program and by category (Outpatient, Residential, Recovery) how many clients meet these conditions.
I need to count the maximum discharge date per client's category level and program.
I need the totals to show up as such in my report.
Outpatient (total=19) <====(Category Level)
Aurora (total=11) <====(Site Level)
Aurora OP 426 (total=5) <====(Program Level)
Aurora IOP 434 (total=6) <====(Program Level)
Springfield (total=8) <====(Site Level)
Springfield OP 737 (total=8) <====(Program Level)
Residential (total=26) <====(Category Level)
Aurora (total=18) <====(Site Level)
Aurora RR 969 (total=18) <====(Program Level)
Springfield (total=8) <====(Site Level)
Springfield RR 893 (total=8) <====(Program Level)
I have a couple calculations.
My first is my grouping the program numbers into their appropriate categories.
ServiceCategory=
if {admission_data.program_code} IN ["212","214","239","245","251","301","302","313","333","363","365","381","396","398","399","413","422","426","444","448","601","603","605","607","609","649","650","651","653","654","655","656","657","658","659","669","712","713","734","736","748","749","2053","2054","2055","2056","2057","2058","2333","2363"] then "OP"
else if {admission_data.program_code} IN ["199","211","215","216","253","258","315","316","344","346","347","351","361","364","415","423","433","434","660","711","731","741","747"] then "RES"
else if {admission_data.program_code} IN ["213","349","393"] then "REC"
Next, I've tried to distinguish which clients meet the criteria.
{SCclose}=
if {discharge_data.date_of_discharge}=maximum({discharge_data.date_of_discharge},{admission_data.blank_row_id}) and (({ServiceCategory}="OP") or ({ServiceCategory}="RES")or ({ServiceCategory}="REC")) then 1 else 0;
Now I am trying to sum where the 1's are, but it won't let me sum {SCClose} and I am completely stuck.