Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

How to get the number 1 if the time span between same or different vehicle is more than 1 hour

Hi,

      i should get the value 1 in seperate column if the time is 1 hour difference between same or different vehicles and empty if diff is less than 1 hour. There more than 1 lakh data in the table.

Capture.PNG

1 Solution

Accepted Solutions
Highlighted
Contributor III
Contributor III

Re: How to get the number 1 if the time span between same or different vehicle is more than 1 hour

Thank you Felip.

It works.

View solution in original post

4 Replies
Highlighted
Partner
Partner

Re: How to get the number 1 if the time span between same or different vehicle is more than 1 hour

Hi,

Do something like this:

data:

Load

     [Vehicle No],

     [Date & Time]

     //OTher fields here too

From [Whatever];

_tmpField:

load

     [Vehicle No],

     [Date & Time],

     if

     (

          peek([Vehicle No]=[Vehicle No],

          if

          (

               [Date & Time]-peek([Date & Time])>1,

               1,

               0

          )   

     ) as [Flag Difference bigger then 1]

Resident data

order by

     [Vehicle No],

     [Date & Time]

;

left join (data)

Load *

Resident _tmpField;


drop table _tmpField;

Highlighted
Contributor III
Contributor III

Re: How to get the number 1 if the time span between same or different vehicle is more than 1 hour

Thank you Felip.

It works.

View solution in original post

Highlighted
Partner
Partner

Re: How to get the number 1 if the time span between same or different vehicle is more than 1 hour

Can't you mark my answer as correct since it helped you?

Highlighted
Contributor III
Contributor III

Re: How to get the number 1 if the time span between same or different vehicle is more than 1 hour

we should do it in front end reporting in straight table by loading the excel file