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

Selection between two timestamps thath fulfill certain criteria

For distinct ID I am trying to find out what is the time difference between the log A and log B (there are sometimes different log types in between, but they don't matter)


Screenshot_6.jpg

so I was thinking to insert such a query:

if(Log = 60, Timestamp) - if(Log = 70, Timestamp) as TimeLogsDiff

but it doesn't work.

Does anyone has an idea?

1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Barbara,

since your Log numbers and dates appear in different rows of your table, your formula can never produce results, because it can't be performed in a single row. You need to transform your table in such as way that both Log Numbers and both Dates are in the same row. For example:

LogSum:

LOAD

     ID, 

     TimeStamp60 - TimeStamp70 as TimeLogsDiff

;

LOAD

     ID,

     min(IF(Log=60, Timestamp) as TimeStamp60,

    min(IF(Log = 70, Timestamp) as TimeStamp70

resident

     Lolg

group by

    ID

;

Cheers,

Oleg Troyansky

Upgrade your QlikView and Qlik Sense skills at the Masters Summit for Qlik - coming to Stockholm on April 1st!