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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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
MVP
MVP

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
Partner - Champion II
Partner - Champion II

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
MVP
MVP

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
Partner - Champion II
Partner - Champion II

I, for once, was quicker than u on this

sunny_talwar
MVP
MVP

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 ?