Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

End Of Contract Formula

Dears,

I hope you are well,


I want to get the End Of Contract result for each employee as shown in the below table:

   

EmployeeStartDateContract PeriodStatusEnd Of Contract
John2/7/20022Renewed2/7/2018
Sergio1/3/20152Renewed1/3/2017
Michael10/5/20102Renewed10/5/2018
Sara1/9/20012Renewed1/9/2017
Joly1/9/19902Renewed1/9/2018
Boadicea4/17/20142Renewed4/17/2018

The formula for end of contract is :

=DATE(YEAR(B2) + DATEDIF(B2, DATE(2017, MONTH(B2), DAY(B2)), "Y") + ISEVEN(YEAR(B2)), MONTH(B2), DAY(B2))

my issue is that I need to convert this formula to Qlikview logic so I can show this report in QLikview. Or if there is any other formula can do the same that would be fine. 

Can anyone help me out here.

Thanks,

Ibrahim

1 Solution

Accepted Solutions
sunny_talwar

Try this may be:

Table:

LOAD Employee,

     StartDate,

     [Contract Period],

     Status,

     Date(MakeDate(2017 + (-1*Even(Year(StartDate))), Month(StartDate), Day(StartDate))) as [End Of Contract]

FROM

[https://community.qlik.com/thread/215657]

(html, codepage is 1252, embedded labels, table is @1);


Capture.PNG

View solution in original post

5 Replies
sunny_talwar

Try this may be:

Table:

LOAD Employee,

     StartDate,

     [Contract Period],

     Status,

     Date(MakeDate(2017 + (-1*Even(Year(StartDate))), Month(StartDate), Day(StartDate))) as [End Of Contract]

FROM

[https://community.qlik.com/thread/215657]

(html, codepage is 1252, embedded labels, table is @1);


Capture.PNG

sunny_talwar

This one should also work:

Date(AddYears(StartDate, 2017 - Year(StartDate) + (-1*Even(Year(StartDate))))) as [End Of Contract1]

swuehl
MVP
MVP

Another (shorter) option would be

  SetDateYear(StartDate, 2017-Even(Year(StartDate))) as [End Of Contract2]

Anonymous
Not applicable
Author

Thank you so much ..

that's what I was looking for.

Thanks,

Ibrahim

oknotsen
Master III
Master III

If your question is now answered, please flag the Correct Answer.

If not, please make clear what part of this topic you still need help with.

Please do not start new questions in the same topic.

May you live in interesting times!