Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Ironzem
Contributor III
Contributor III

Calculate diffrence in value to previous entry

Hi , I need to calculate the Sequence difference to the previous entry for every unique ID

The result is the I am looking for is the added difference coloum

Date Time Sequence ID   Difference
2022/10/01 07:09 166 24298574917860142    
2022/10/01 07:28 167 24298574917860142   1
2022/10/04 06:47 168 24298574917860142   1
2022/10/04 07:10 169 24298574917860142   1
2022/10/05 06:49 172 24298574917860142   3
2022/10/05 07:13 173 24298574917860142   1
2022/10/06 06:49 176 24298574917860142   3
2022/10/06 07:11 177 24298574917860142   1
2022/10/08 07:18 180 24298574917860142   3
2022/10/08 07:39 181 24298574917860142   1
2022/10/10 06:49 182 24298574917860142   1
2022/10/10 07:10 183 24298574917860142   1
2022/10/10 07:14 184 24298574917860142   1
Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

in load script

Temp:
Load
Date
,Time
,Sequence
,ID
From SomeSource.qvd;

Main:
Load *
,ID-peek(ID) as Difference
Resident Temp
Order by Date,Time,ID ASC;
Drop table Temp;

 

 

IF In Chart then

=ID - Above(ID)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
vinieme12
Champion III
Champion III

in load script

Temp:
Load
Date
,Time
,Sequence
,ID
From SomeSource.qvd;

Main:
Load *
,ID-peek(ID) as Difference
Resident Temp
Order by Date,Time,ID ASC;
Drop table Temp;

 

 

IF In Chart then

=ID - Above(ID)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Ironzem
Contributor III
Contributor III
Author

Thank you - I think there was a typo , ID--->Sequence