Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
tchovanec
Creator II
Creator II

Get Age in Months

I am trying to get the age in months for someone for every month. So I created a table that holds the month end for every month from 2009 - 2013. You will see how I create this below.

 

LET vMinDate = NUM(DATE('1/1/2009'));
LET vMaxDate = NUM(DATE(TODAY()));

TempCalendar:
LOAD
      $(vMinDate) + RowNo() - 1 AS DateNumber
AUTOGENERATE 1
WHILE $(vMinDate) + IterNo()-1 <= $(vMaxDate);

MonthEnd:
Load
      DateNumber
      ,Floor(MonthEnd(DateNumber))as MonthEnd
      ,Floor(MonthStart(DateNumber)) as MonthStart
RESIDENT TempCalendar;

I also have a table that holds the date of birth for an individual. I am trying to create a table that will hold the DOB, MonthEnd, MonthStart and the Age at that at that time. So the table will look like something below.

PatientNumberDOBMonthStartMonthEndAgeInMonths
112/01/200801/01/200901/31/20091
112/01/200802/01/20092/28/20092
112/01/200803/01/201303/31/201351

Any help would be greatly appreciated. Thank you.

Labels (1)
1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find below link

http://community.qlik.com/docs/DOC-3836

Hope this helps you.

Regards,

Jagan.

View solution in original post

2 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find below link

http://community.qlik.com/docs/DOC-3836

Hope this helps you.

Regards,

Jagan.

tchovanec
Creator II
Creator II
Author

Jagan, 

This will work great once I get the data into one table. I am struggling with getting the data into one table. Below are examples of the two tables I have.

PatientNumberDOB
101/01/2010
212/10/2008
308/11/2009
407/01/2011
506/30/2012

DateMonthEnd
01/01/201001/31/2010
01/02/201001/31/2010
01/03/201001/31/2010

Here is the final table I am looking at trying to get.

PatientNumberDOBMonthEnd
101/01/201001/31/2010
101/01/201002/28/2010
101/01/201003/31/2010
101/01/201004/30/2010
212/10/200801/01/2009
212/10/200802/28/2009
212/10/200803/31/2009
308/11/200909/09/2009

So for every patient number and DOB there will be 12 records a year. Thanks again for the help.