How to identify anniversaries next month?

CRV 11 - I have an anniversary report that runs on the 20th of every month showing anniversaries in the upcoming month (regardless of day) .
The December 20th report showed two employees; one with a hire date of 1/3/2011 (result was 6 yrs of service) and one with a hire date of 1/28/2013 (result was 4 yrs of service).  BOTH results are short one year and should be 7 and 5.  The formula I'm using is Year (currentdate) - Year({EMPLOYEE.DATE_HIRED}).  Any advice would be appreciated.
jph826Asked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
Your formula works for every month except the December run because of crossing the year boundary.

I can think of 2 solutions. The easy solution is to test for current month = 12 then add 1

If Month(CurrentDate) = 12 then
    Year (currentdate) - Year({EMPLOYEE.DATE_HIRED} + 1
Else
    Year (currentdate) - Year({EMPLOYEE.DATE_HIRED}

Open in new window


The other will work depending on how you are selecting the date range.  If you are prompting for the date range you could use the date value from the parameter instead of current date.

Year({?StarDate}) - Year({EMPLOYEE.DATE_HIRED


mlmcc
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
See: http://www.kenhamady.com/formulas/form06.shtml
"The problem with calculating age is that it is calculated as an integer, and always rounded down..."
0
 
jph826Author Commented:
Thank you, that worked.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.