Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to calculate the age of people on a specific date. 31st December 2016. I already have the DOB and age of people in my data. Can anybody help?
Thanks
Try age function.
Like
age(timestamp, date of birth);
age('2016-12-31', DOB)
Hi Richard,
You can calculate the age of people in two types.
1. Floor((Date('2016-12-31')-DOB)/365)
2. Age('31-12-2016',DOB)
Timestamp is not important. U can write any format.
Regards,
Dinesh Kumar M
age(makedate(2016,12,31), DOB)
Below is the script but its still returning only null values.... Further help would be appreciated.
LOAD 1 as PersonIDCounter,
P_ID as PersonID,
P_REFERENCE as [Person Reference],
P_SURNAME as Surname,
P_FORENAMES as Forename,
P_FORENAMES & ' ' & P_SURNAME as [Full Name],
applymap('GenderMap',P_GENDER , 'Missing') as Gender,
P_DOB,
age(today(), [P_DOB]) AS [Person Age],
age(MakeDate('2015,09,31'), [P_DOB]) as [Person summer school leaving age 2015],
P_PERSONADDRESS as AddressID,
In your code for age remove the single quotes
What is your [P_DOB] format (I mean is it 'MM/DD/YYYY' or 'YYYY-MM-DD' etc...)
like age(MakeDate(2015,09,31), [P_DOB]) as [Person summer school leaving age 2015]
Year(DateFieldToCalculate) - Num(Right(P_DOB,4))AS Person Age
Edit: Switch the Right to Left depending on if your date is formatted with the year first or last.