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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Difference

I have a Two Column Date of Joining and Date of Resignation ...

Example :Date of Joining - 01/01/2012  And  Date of Resignation - 02/05/2015

so i want the Out Put how many Year Month and Day Employee works.. like .. 3 year 4 Month and 1 Day ...


Plz Tell me

23 Replies
Not applicable
Author

Hello Brijesh,

in you script(Where you load your data) add a column and based on Anbu's add the below.

Floor(Interval([Date of Joining]-[Date of Resignation],'DD')/365) & ' Years ' & Floor(Mod(Interval([Date of Joining]-[Date of Resignation],'DD'),365)/30) & ' Months ' & Mod(Mod(Interval([Date of Joining]-[Date of Resignation],'DD'),365),30) & ' Days ' as [Total Number of Period Person worked]

hop this helps

Not applicable
Author

Excel ... I have a Two column .. one of Date of Joining and Second of Date of Resignation.. so i need to find out total

how many period employee worked..

Kindly tell me... Thanks

anbu1984
Master III
Master III

Load *,Floor(Days/365) & ' Years ' & Floor(Mod(Days,365)/30) & ' Months ' &Mod(Mod(Days,365),30) & ' Days ';
Load *,Interval(DOR-DOJ,'DD') As Days;
lOAD Date#(DOJ,'DD/MM/YYYY') As DOJ,Date#(DOR,'DD/MM/YYYY') As DOR;

Load DOJ,DOR From Excel.xlsx; //Edit Script --> Table Files --> File Wizard -- This will automatically create load statement

Not applicable
Author

so first i need to load my date data

Load DOJ,DOR,

Date#(DOJ,'DD/MM/YYYY') As DOJ1,

Date#(DOR,'DD/MM/YYYY') As DOR1,

Interval(DOR1-DOJ1,'DD') As Days

From Excel.xlsx;

BUT while Reloading its giving me a Error Field not found - <DOR1>...

kinldy help me how to write this code....

anbu1984
Master III
Master III

Load DOJ,DOR,

Date#(DOJ,'DD/MM/YYYY') As DOJ1,

Date#(DOR,'DD/MM/YYYY') As DOR1,

Interval(DOR1-DOJ1,'DD') As Days //You are getting error since DOR1 is not present in your input excel

From Excel.xlsx;

Calculate difference in preceding load

Load *, Interval(DOR1-DOJ1,'DD') As Days; //Preceding Load

Load DOJ,DOR,

Date#(DOJ,'DD/MM/YYYY') As DOJ1,

Date#(DOR,'DD/MM/YYYY') As DOR1

From Excel.xlsx;

Not applicable
Author

if i m doing this ways its not showing any data of Days:

     

DOJDORDOJ1DOR1Days
2/4/20123/2/20154100142038 -
3/4/20124/2/20154100242039 -
6/5/20125/6/20154103542160 -
9/6/20126/9/20154106942253 -
12/9/20129/12/20154116442347 -
4/10/201210/4/20154118642104 -
5/1/20158/5/20154200942132 -
3/7/20157/3/20154218842070 -
3/7/20158/5/20154218842132 -
5/8/20158/5/20154222142132 -
Not applicable
Author

its giving me a Data.. But I have date format DD/MM/YYYY.. and its giving a Data in MM/DD/YYYY Format...kinldy help Me

anbu1984
Master III
Master III

Can you post sample excel file

Not applicable
Author

DOJDOR
3/12/201129/05/2012
1/12/20133/5/2015
4/4/20116/7/2014
29/01/201331/12/2014
1/5/20115/5/2014
anbu1984
Master III
Master III

When I pasted above data into excel, some of the rows have date and others are general. Its better you keep data in one format.

Can you attach sample excel file.