Discussion Board for collaboration on QlikView Scripting.
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.
Go to Solution.
If (len (dischargedate)>0,num (dischargedate)-num (admitdate),num (today ())-num (admitdate)) as LOS
alt(DischargeDate - AdmitDate, today() - AdmitDate)
Thank you, this worked like a charm!
This works as well! Thank you, now I have two options.