Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

age function in year and month format

if i have birthdate, how can i write age funcation in such a manner it will show me number of years.month .. for example if age is 28 years 3 months. then it has to show me as 28.3

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

age(Today(),DOB) & ' Years and ' &(if(day(Today()) >= day(DOB),

  mod((Year(Today())*12+Month(Today()))-(Year(DOB)*12+Month(DOB)),12),

  if(mod((Year(Today())*12+Month(Today()))-(Year(DOB)*12+Month(DOB)),12)=0,11,mod((Year(Today())*12+Month(Today()))-(Year(DOB)*12+Month(DOB)),12)-1))) &' Months'

CHANGE DOB to Whatever your date field...

View solution in original post

1 Reply
MK_QSL
MVP
MVP

age(Today(),DOB) & ' Years and ' &(if(day(Today()) >= day(DOB),

  mod((Year(Today())*12+Month(Today()))-(Year(DOB)*12+Month(DOB)),12),

  if(mod((Year(Today())*12+Month(Today()))-(Year(DOB)*12+Month(DOB)),12)=0,11,mod((Year(Today())*12+Month(Today()))-(Year(DOB)*12+Month(DOB)),12)-1))) &' Months'

CHANGE DOB to Whatever your date field...