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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
yoganantha321
Creator II
Creator II

Joining the dates

Hi,

I have two tables

Table 1:

It consists of EmployeeID and Date of joining of the employee:

LOAD [EmpID] as  EmployeeID,

    date(date(left(EmpDataofJoining, len(EmpDataofJoining)-9)),'MM/DD/YYYY') as DateofJoining

FROM

Ava_EmployeeMasterList.csv

(txt, unicode, embedded labels, delimiter is '\t', msq);

Table 2:

It consists of EmployeeID  and RelievingDate of the employee:

LOAD EmployeeID,

    If(Len(Trim(RelievingDate)) = 0, Date(Today(),'MM/DD/YYYY'), Date(RelievingDate,'MM/DD/YYYY')) as RelievingDate

FROM

EPE_LSTRelievingFormInfo.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

The requirement is:


I want to column as Date  which consists of dateofjoining as a minimum date and

if the employee is relieved  maximum as RelievingDate or

if the employee is not relieved  maximum as today


For example I have filter employeeID 138

Screenshot_63.png

the employee was joined in the organization on 08/16/2016 and not relieved and working on the organization. so I need a column Date consists of all the dates from 08/16/2016 to 05/29/2017.

Screenshot_64.png


I have used the below script

EmployeeInfo:

LOAD [EmpID] as  EmployeeID,

    date(date(left(EmpDataofJoining, len(EmpDataofJoining)-9)),'MM/DD/YYYY') as DateofJoining

FROM

Ava_EmployeeMasterList1.csv

(txt, unicode, embedded labels, delimiter is '\t', msq);

join

LOAD EmployeeID,

    If(Len(Trim(RelievingDate)) = 0, Date(Today(),'MM/DD/YYYY'), Date(RelievingDate,'MM/DD/YYYY')) as RelievingDate

FROM

EPE_Data\EPE_LSTRelievingFormInfo1.csv

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

presentEmp:

LOAD EmployeeID,

  DateofJoining as DateofJoining1,

  RelievingDate as RelievingDate1

Resident EmployeeInfo;

MinMax:

LOAD Min(DateofJoining1) as Min,

  Max(RelievingDate1) as Max

Resident presentEmp;

LET vMin = Peek('Min');

LET vMax = Peek('Max');

DROP Table MinMax;

Calendar:

LOAD Date(Date,'MM/DD/YYYY') as Date ,

    Date as MonthYear;

LOAD Date($(vMin) + IterNo() - 1) as Date

AutoGenerate 1

While $(vMin) + IterNo() - 1 <= $(vMax);

Left Join (presentEmp)

IntervalMatch (Date)

LOAD DateofJoining1,

    RelievingDate1

Resident presentEmp;

DROP Fields DateofJoining1,RelievingDate1;


But it is not working it is showing as not associated


Screenshot_65.png

Anyone can help me!

I have attached my sample data along with this

Regards

Yoganantha Prakash G P

3 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi,

as idea look attached file. In your data where can I see that the employee has not been fired yet, and the previous dates were just his movements?

Regards,

Andrey

yoganantha321
Creator II
Creator II
Author

Andrey,

If the employee is not fired(relieving date)

i.e doesn't have relieving date means he is still continuing and the max date is today.

yoganantha321
Creator II
Creator II
Author

Andrey,

You have used the data of joining as the same date of relieving it should not be like that