Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
thomas_evans
Partner - Contributor III
Partner - Contributor III

List of dates between two dates

Hi All,

Can someone help me to make a list of dates between two dates please.

Example data:

Cert:

Load * Inline [

StartDate, ExpiryDate, PersonID, CertID

'2010-01-15', '2010-01-17', 999, 3,

'2010-01-16', '2010-01-20', 888, 2,

'2011-05-17', '2010-05-22', 555, 1

];

Expected result:

PersonID, CertID, Date

999, 3, 2010-01-15

999, 3, 2015-01-06

999, 3, 2016-01-17

888, 2, 2010-01-16

888, 2, 2010-01-17

888, 2, 2010-01-18

888, 2, 2010-01-19

888, 2, 2010-01-20

555, 1, 2011-05-17

555, 1, 2011-05-18

555, 1, 2011-05-19

555, 1, 2011-05-20

555, 1, 2011-05-21

555, 1, 2011-05-22

FTI multiple certID may exist across same timeframe.

Thanks,

Thomas

1 Solution

Accepted Solutions
sunny_talwar

Try this

Cert:

LOAD CertID,

PersonID,

Date(StartDate + IterNo() - 1) as Date

While StartDate + IterNo() - 1 <= ExpiryDate;

LOAD * INLINE [

    StartDate, ExpiryDate, PersonID, CertID

    2010-01-15, 2010-01-17, 999, 3

    2010-01-16, 2010-01-20, 888, 2

    2011-05-17, 2011-05-22, 555, 1

];

View solution in original post

5 Replies
OmarBenSalem

table:

LOAD CertID,PersonID,StartDate,ExpiryDate,Date(StartDate + IterNo() - 1) as Date

While StartDate + IterNo() - 1 <= ExpiryDate

;

Load date(Date#(StartDate,'YYYY-MM-DD')) as StartDate,date(Date#(ExpiryDate,'YYYY-MM-DD')) as ExpiryDate, PersonID, CertID  Inline [

StartDate, ExpiryDate, PersonID, CertID

'2010-01-15', '2010-01-17', 999, 3

'2010-01-16', '2010-01-20', 888, 2

'2010-05-17', '2010-05-22', 555, 1

];

result:

Capture.PNG

sunny_talwar

Try this

Cert:

LOAD CertID,

PersonID,

Date(StartDate + IterNo() - 1) as Date

While StartDate + IterNo() - 1 <= ExpiryDate;

LOAD * INLINE [

    StartDate, ExpiryDate, PersonID, CertID

    2010-01-15, 2010-01-17, 999, 3

    2010-01-16, 2010-01-20, 888, 2

    2011-05-17, 2011-05-22, 555, 1

];

OmarBenSalem

I, for once, was quicker than u on this

sunny_talwar

Omar, my friend... you are the man!!

pallavi_92
Contributor II
Contributor II

I have a similar scenario, but my data is huge.

It's taking ages to get this new table with all the dates. Is there any solution for that ?