Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Add Date to Every EmpID

Hi All,

I have a table of employee IDs and I need to create an entry for each day of the year.  What's the best way to do this?

Example:

empID  000001 then I need an entry for each day for this employee.

00001  Jan 1, 2020

00001  Jan 2, 2020  etc.

 

Thanks

Labels (1)
  • logic

14 Replies
edwin
Master II
Master II

i ran your code using made up emp ID and am able to generate the dates

tmumaw
Specialist II
Specialist II
Author

I get this message:

Table not found error

Table 'EmpID' not found

left join(EmpID)
LOAD date(date('1/1/2020') + iterno()-1) as Date
autogenerate 1
while date(date('1/1/2020') + iterno()-1) <= date('12/8/2020')

 

Here's my script:

Employees:
LOAD
[Employee Number] as ENo
FROM
[D:\Qlikview\QVD\HR\Infotype0000.QVD] (qvd)
where Employment_STAT2= '3' and [End Date] = '12/31/9999'
;

EmpID:
LOAD
fieldvalue('ENo',recno()) as ENo
autogenerate fieldvaluecount('ENo')
;

left join(EmpID)
LOAD date(date('$(vStartDate)') + iterno()-1) as Date
autogenerate 1
while date(date('$(vStartDate)') + iterno()-1) <= date('$(vEndDate)');

;

left join(Employees)
LOAD *
resident EmpID;

drop table EmpID;
Exit Script;

tmumaw
Specialist II
Specialist II
Author

Ignore my message forgot the Noconcatinate

tmumaw
Specialist II
Specialist II
Author

Thanks Edwin for all the help.

edwin
Master II
Master II

np, considering the dataset is small, i would just go with your solution which makes for a simpler expression -> easier to maintain.