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: 
davemontoya
Contributor II
Contributor II

Dates do not substract

Hi community, I have this line to subtract dates, but the result cell shows empty. No error shows when I run the script. What am I doing wrong? I also have other conditions "=" equal to something and does not work. 

Table result:

azTienePendingazFinishResolvedazInicioAlerStartStatusHistory.Pending.TimeazTTRMA
112/11/2019 18:04:361/11/2019 0:00:021/11/2019 2:07:23-

 

,if([azTienePending]=1

, [azFinishResolved]-[azInicioAlerStart]

, [StatusHistory.Pending.Time]-[azInicioAlerStart])

as [azTTRMA]

 

//Attached qvd, qvf and excel. The script is in the loadeditor "seccion 7"

//https://drive.google.com/drive/folders/1wkqCzePm-itLFrU-6-Dx0OeL-UrhcMHy?usp=sharing

1 Reply
jonathandienst
Partner - Champion III
Partner - Champion III

The dates are probably not being recognised by QS, so they are loaded as strings. Give QS a little help in the load script using:

LOAD ...
      Date#(azFinishResolved, 'dd/MM/yyyy hh:mm:ss') as azFinishResolved,
      Date#(azInicioAlerStart, 'dd/MM/yyyy hh:mm:ss') as azInicioAlerStart,
...

Now you should be able to perform date arithmetic on these fields.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein