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

Create dates between 2 dates

Hi,

I have a table in excel that I need to bring into Sense.  What I need is the table to show all dates between the admissiondate and the discharge date so from - 

PatientIDEventNumberAdmissionDateDischargeDateSequenceID
156858113/09/2017 10:0025/10/2017 13:304
169650110/08/2017 12:0011/10/2017 14:006
169770118/08/2017 12:0017/10/2017 14:347
169329105/09/2017 12:0031/10/2017 09:548
3000177127/09/2017 12:0012/01/2018 12:009

 

to

PatientIDEventNumberAdmissionDateDischargeDateSequenceIDDate
156858113/09/2017 10:0025/10/2017 13:30413/09/17
156858113/09/2017 10:0025/10/2017 13:30414/09/17
156858113/09/2017 10:0025/10/2017 13:30415/09/17
156858113/09/2017 10:0025/10/2017 13:30416/09/17
156858113/09/2017 10:0025/10/2017 13:30417/09/17

 

etc

Kev

1 Solution

Accepted Solutions
PrashantSangle

Try
Load
PatientID,
EventNumber,
AdmissionDate,
DischargeDate,
SequenceID,
Date(AdmissionDate + IterNo() -1) as Date
from tableName
while AdmissionDate + IterNo() - 1 < = DischargeDate;

Regards,
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

5 Replies
PrashantSangle

Try
Load
PatientID,
EventNumber,
AdmissionDate,
DischargeDate,
SequenceID,
Date(AdmissionDate + IterNo() -1) as Date
from tableName
while AdmissionDate + IterNo() - 1 < = DischargeDate;

Regards,
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
kev6brown
Partner - Creator
Partner - Creator
Author

This creates millions of rows

PrashantSangle

It is as per your requirement only.
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
kev6brown
Partner - Creator
Partner - Creator
Author

its because i had null, thank you

kev6brown
Partner - Creator
Partner - Creator
Author

How can i set the discharge date to today and it still work? I've got the below but i think something with the "While" needs doing

vent:
LOAD
PatientID,
EventNumber,
AdmissionDate,
AdmissionDate as CalendarKey,
Date(AdmissionDate + IterNo() -1) as Date,
if(DischargeDate='NULL',Today(),DischargeDate) as DischargeDate,
SequenceID
FROM [..\..\.xlsx]
(ooxml, embedded labels, table is ImsEvent)
while AdmissionDate + IterNo() < DischargeDate;