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

calculate the time gap between the dates group by another dimension

NameDateEventTime Gap
A04/01/2012TEXT
A03/05/2013TEXT
A04/12/2013TEXT*
B01/01/2016TEXT
C09/27/2015TEXT
C10/04/2017TEXT

I want to calculate the time gap between the dates by Name.

for * marked cell, fill the cell with the number value(number of days difference between 04/12/2013 and 03/05/2013).

for Name B, there is just one date value, so just leave it Time Gap cell as '-'

Could anybody help me??

1 Solution

Accepted Solutions
aarkay29
Specialist
Specialist

How about using this in the script?

If(Name=peek(Name),Date-peek(Date),'') as [Time Gap]

View solution in original post

3 Replies
aarkay29
Specialist
Specialist

How about using this in the script?

If(Name=peek(Name),Date-peek(Date),'') as [Time Gap]

rupamjyotidas
Specialist
Specialist

What will be the difference between third A and 2nd A???

LOAD Name,

     Date,

     Event,

     if(Peek(Name)=Name,(Date)-Peek(Date),'-') as Gap

FROM

[https://community.qlik.com/thread/250763]

(html, codepage is 1252, embedded labels, table is @1);

Not applicable
Author

they are the same, 1st,2nd and 3rd A.

Thank you