AnsweredAssumed Answered

Calculation field mismatch between files - why?

Question asked by jjgarner on Jun 17, 2016
Latest reply on Jun 23, 2016 by alquimby

Hey all,

 

I noticed that two distinct filemaker files I work with are giving very different "Current Age" calculations, dispute using the exact same calculation code and the exact same data.

 

The calculation is:

Let (

  [

  cd =  Get ( CurrentDate )  ;

  dob = DateBirth ;

  years = Year ( cd ) - Year ( dob ) - ( Month ( cd ) < Month ( dob ) or Day ( cd ) < Day ( dob ) ) ;

  months = Case ( Month ( cd ) ≤ Month ( dob ) ; 12 + Month ( cd ) - Month ( dob ) ; Month ( cd ) - Month ( dob ) ) - ( Day ( cd ) < Day ( dob ) )

  ] ;

years & " Years, " & months & Case ( months = 1 ; " Month" ;  " Months" )

)

 

Where "DateBirth" is an Indexed, 4-didgit Year Date type field.

 

One file is doing this calculation perfectly, and the other is 5-8 months off on each record.  Weird!

 

Does anyone know why this may be happening, what I might be doing wrong or not accounting for?

 

Thanks in advance!

Outcomes