Crystal Reports: Need a formula for the first time patient seen and last time during a certain time period

Here is the formula to give me a readable date a patient was seen:


I need to know the formula that will look for the first time the patient was seen and the last time the patient was seen during a certain time period of 01/01/2012 to current.  I can configure the date range OK.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use Minimum and Maximum to get the min and max dates.

If you group by patient your summary functions can use the grouping to get the dates for each patient

CDate(Minimum({Archrg99.D_ServiceFrom}, {PatientID})-18261)

CDate(Maximum({Archrg99.D_ServiceFrom}, {PatientID})-18261)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kvrogersAuthor Commented:
Thanks for you help.  This solution worked.
kvrogersAuthor Commented:
Well upon validation this did not work.  
For the field FIRST DATE OF SERVICE, I am getting duplicate information for some patients.  

What other information from me would be helpful.  I can upload the report but I will have to take out some patient information and just leave the Pat_Ext_ID as this is a Group By and take away anything else.  Would that help?

What do you mean by "duplicate"?  There will only be one minimum and one maximum for each group.  Where are you seeing duplicates?

 Uploading the report might be helpful.

kvrogersAuthor Commented:
I did manage to get the formula to work.  
I took out the Patient ID code from the formula above and it worked correctly.  
Also noted that my JOINS were not correct.
Once I did all this it worked perfectly.

Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.