Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
P_Kale
Creator II
Creator II

How to Add number of Years in a Date column

Hi,

In a data I have a date column and number of Year column. Now I want to add number of Yer columns into date column to arrive at a final date. For E.g.

Date :- 01/01/2003 Year = 15 Then Final Date is 01/01/2018

Date :- 15/04/2010 Year = 25 Then Final Date is 15/04/2035

How I can achieve this.

Thanks in advance.

 

 

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@P_Kale  you can do it in your load script

Load PolicyStartDate,
         Year,
         AddYears(PolicyStartDate,Year) as PolicyEndDate
FROM Table

View solution in original post

8 Replies
Padma123
Creator
Creator

AddYears(Date,Year)

P_Kale
Creator II
Creator II
Author

Hi,

Thanks for your reply.

But I have list of policies for which i need to calculate.

Padma123
Creator
Creator

can you please share sample data what you want exactly 

gomeri
Partner - Creator
Partner - Creator

Hi,

can you share with us a little example please?

For a better undestanding of problem.

if I understand correctly you want to sum number of years in a column with data.

For do this this is a possible solution:

 

=Text(Year(Date( Date , 'MM/DD/YYYY'))+ NumberOfYear )

 

let me know if that was what you were looking for.

Thanks

Giovanni O. D.
Kushal_Chawda

@P_Kale  you can do it in your load script

Load PolicyStartDate,
         Year,
         AddYears(PolicyStartDate,Year) as PolicyEndDate
FROM Table

QFabian
Specialist III
Specialist III

this works perfectly @Kushal_Chawda , thanks

QFabian
sriram____777
Contributor II
Contributor II

Check this  years count added as of my understanding

T:
Load *,
Replace(Olddate,Right(Olddate,4),updatedyear) as updatedDate;
Load *,
Text(Year(Date( Olddate , 'MM/DD/YYYY'))+ count ) as updatedyear ;
Load *,
Date(Date#(mydate,'DD/MM/YYYY'),'MM/DD/YYYY') AS Olddate;
Load * Inline [
mydate, count
02/05/2015, 10
02/05/2011, 10
02/05/2013, 10
];

Drop Field mydate;
P_Kale
Creator II
Creator II
Author

Thanks for your help @Kushal_Chawda It is working.