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

Creating a list table based on two or more tables and using Is Null


Hello,

I was wondering if I could get some guidance on how to create a table by creating a new column in my data.  Currently I have:

AdmitDate, (format: M/D/YYYY)

DischargeDate (format: M/D/YYYY)

I want to create a LOS (length of stay) column that is based on the Admit and Discharge Dates:

LOS = DischargeDate - AdmitDate

In addition, if the DischargeDate column is NULL (or empty: no discharge date), then the LOS would be:

LOS= TODAY - AdmitDate.

I want to do this in the load script, but do not know the syntax to use.  Any help is very appreciated.

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

Hi,

Try this

If (len (dischargedate)>0,num (dischargedate)-num (admitdate),num (today ())-num (admitdate)) as LOS

View solution in original post

4 Replies
settu_periasamy
Master III
Master III

Hi,

Try this

If (len (dischargedate)>0,num (dischargedate)-num (admitdate),num (today ())-num (admitdate)) as LOS

maxgro
MVP
MVP

try with

alt(DischargeDate - AdmitDate, today() - AdmitDate)

Not applicable
Author

Thank you, this worked like a charm!

Not applicable
Author

This works as well!  Thank you, now I have two options.