Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
rdsuperlike
Creator
Creator

calculate date from years of service

I have "years of service" column in my database with value for eg 4.34. How do i calculate the service date?

Logically it should be Date(Today() - "years of service")

But can someone help me write exact expression in load script.

Thanks

2 Replies
Nicole-Smith

I believe something like this should work:

SELECT    Years_of_Service,

          Date(Today()-Years_of_Service*365.25) as Service_Date

FROM YourTable;

You can test it with this:

LOAD Years_of_Service,

     Date(Today()-Years_of_Service*365.25) as Service_Date

INLINE [

Years_of_Service

2.34

4.34

];

MarcoWedel

please post some sample values and your expecetd result.

It's not quite clear, how the fractional year part is calculated in the first place. There might be different methods (fixed number of days per year vs. considering leap years...)

thanks

regards

Marco