Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlikers,
I wrote this interval function to subtract two dates and times. For the most part, it is working, but for some reason, it is throwing out a null value for every time value:
Interval(Timestamp(corDate&' '&corTime)-Timestamp(date(date,'YYYY-MM-DD')&' '&ime),'hh:mm:ss')as Corrected_Interval,
ID | ime | corTime | Corrected_Interval |
26849810 | 08:54:33 | 08:54:40 | 0:00:07 |
26849810 | 08:54:33 | 08:54:40 | - |
26849809 | 08:54:33 | 08:54:40 | 0:00:07 |
26849809 | 08:54:33 | 08:54:40 | - |
26849808 | 08:54:33 | 08:54:40 | 0:00:07 |
26849808 | 08:54:33 | 08:54:40 | - |
I've tried to add a where not isnull(Interval(Timestamp(corDate&' '&corTime)-Timestamp(date(date,'YYYY-MM-DD')&' '&ime),'hh:mm:ss')) to the script but still haven't been able to remove the null values. Is there something wrong with my formula?
Hi!
I think you may be confusing interpretation and format functions. I'd try something like
Interval(
(corDate+Time#(corTime, 'hh:mm:ss'))
-
(date+Time#(ime, 'hh:mm:ss')
)
as Corrected_Interval
Where I supposed that corDate and date are properly interpreted by Qlik as dates. I ensure Qlik interprets corTime and ime as times using Time# function (it is an interpretation function, check docs!)
Regards,
Jaime.