Calculation Help- Corrected Age in small children
I am developing a database for operations in children. I need to define a calculation field for "Corrected Age". This is the age of a child born prematurely and is derived from Gestation at birth (no of weeks in utero out of 40) the date of birth (DOB) and the CurrentDate (Date of Operation). Corrected age is less than the actual age by the number of weeks premature i.e. IF a baby is born at 32 weeks (8 weeks premature) and is now 6 months (24 weeks) old, the Corrected Age is 24-8=16 weeks.
I have defined a calculation field for Age in months and another for age in days, based on the CurrentDate and the Date of the Operation (DateOp)
Age in months
Unstored, = Mod ( Month ( Get ( CurrentDate ) ) - Month ( DOB ) + 12 - If ( Day ( Get ( CurrentDate ) ) < Day ( DOB ) ; 1 ; 0 ) ;12 )
Age in days
Unstored, = Day ( Get ( CurrentDate ) ) - Day ( DOB ) + If ( Day ( Get ( CurrentDate ) ) ≥ Day ( DOB ) ; 0 ; If ( Day ( Get (CurrentDate ) - Day ( Get ( CurrentDate ) ) ) < Day ( DOB ) ; Day ( DOB ) ; Day ( Get( CurrentDate )- Day ( Get ( CurrentDate ) ) ) ) )
I defined a Calculation field for Corrected age thus Unstored, = AgeMonths - ( 40 - GestationBirth / 4 )
(GestationBirth is the number of weeks)
I hoped this would return a number in months. What I end up with is a negative in weeks. I have attached a screen shot of a fictitious patient.
What do I need to do to make the Calculation work. I am happy with a Calculation in weeks or months, Although ideally, if age < 6 months, the calculation should return a value in weeks and if > 6 months old, the value should be in months.
Thanks very much in advance