Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
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
Valued Contributor

Re: calculate the time gap between the dates group by another dimension

How about using this in the script?

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

3 Replies
aarkay29
Valued Contributor

Re: calculate the time gap between the dates group by another dimension

How about using this in the script?

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

rupamjyotidas
Valued Contributor

Re: calculate the time gap between the dates group by another dimension

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

Re: calculate the time gap between the dates group by another dimension

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

Thank you