Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

capture dates in between start date and end date

Hello all,

I tried looking for this but could not find a solution

I have a table with the following table loaded into Qlikview

Load

[Employee Number]

Absence Type

[Date Start]

[Date End]

I now need to recreate the table so that it adds a date column which capture all the dates an employee took a leave

Load

[Employee Number]

Absence Type

Date

Figured I need to loop in order to do this.  In programming world the logic would be

load

$vDifference = [Date End] - [Date Start]

[Employee Number]

Absence Type

For i = 0, i < $vDifference, i++

[Date Start] + i as Date;

How do I do this in Qlikview?

13 Replies
swuehl
MVP
MVP

In addition to use Today(1), you may want to change the WHILE clause to

DateList:

LOAD

//Date([Date Start]+iterno()-1) as Date

Date([StartDate]+iterno()-1,'YYYYMMDD') as DatesArray

resident INPUT while [StartDate]+IterNo()-1 <= $(vStopDate);

Anonymous
Not applicable
Author

Thank you very much... u made my day. I spent 1 day on searching this... Thanks again

ltc
Partner - Creator
Partner - Creator

Hi Stefan,

This works pretty great, except it the While/IterNo logic is only being applied to my samples lines from the Input table.  How can I get the logic to be applied to all of the lines in my data set?

Thanks!

ltc
Partner - Creator
Partner - Creator

Hi Stefan,

I made a separate post for my question with sample data.  If you could take a look, I would greatly appreciate it.

Thanks!

https://community.qlik.com/t5/Qlik-Sense-Advanced-Authoring/Need-help-with-While-InterNo/m-p/1722712...