Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get age by choice of year in calendar?


Hi

Until now I used this expression in the script to calculate the age.

(Today(),Date(Date#(Left(Soical-IDnr,8),'YYYYMMDD'))) as Age,

This work fine. But if the user selects 2013 instead of 2014 the age is wrong. One year back in time, the person were one year younger. Ie 19 instead of 20. Can I somehow do the age calculation in the table/chart and make in connected to the choice of year in the calendar? It´s not necessary to have it calculated by the birthday but rather on birthyear or birthyear and month

1 Solution

Accepted Solutions
Not applicable
Author

Thanks for the suggestions. I´d solved it by

Age(Date(Action date field  ), Date(Date#(Left(Social-Idnd,8),'YYYYMMDD'))) 

View solution in original post

4 Replies
its_anandrjs

You can try with this also

Age( Date(Today(),'YYYYMMDD'),Date(Date#(Left(Soical-IDnr,8),'YYYYMMDD'))) as Age,

anlonghi2
Creator II
Creator II

Hi Hofstedt To calculate age on the fly try this age(left(today(),5) & '/' & v_year, date#(Soical-IDnr)) where v_year is the selected year best regards

Not applicable
Author

may be you use interval function here?

=interval(today()-date1,format what to expect in F1 help)

Not applicable
Author

Thanks for the suggestions. I´d solved it by

Age(Date(Action date field  ), Date(Date#(Left(Social-Idnd,8),'YYYYMMDD')))