First simplify the above;
stringvar array codes:= ["99201", "99202", "99203", "99204", "99205",
"99211", "99212", "99213", "99214", "99215", "99241", "99242",
"99243", "99244", "99245"];
{enc.enc_timestamp} in {?Date Range}
and
{provider_mstr.description} in {?Provider}
and
{enc.billable_ind} = "Y"
and
{enc.clinical_ind} = "Y"
and
{proc.cpt4_code_id} in codes
To select the top 1 you'll need to group on a field, I'm not sure what fields you have available or what you want to report on so that decision is up to you.
Once you have a group you need to create a summary on the field you want to display the top one of, ie {proc.create_timestamp}.
Now goto the Group Sort Expert, select the group you want to filter, select Top N, where N is 1 based on the above summary.
Regards,
Ryan.
Edited by rkrowland - 01 Mar 2012 at 11:12pm