Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
RA6
Creator
Creator

Comparing two row based on value

Hello guys,

I have an input file delimited:

0693p00000AGtS4AAL.jpg

What i need to do is to subtract the amount of the highest sequence with highest sequence - 1 based on a composition of columns which is ID, NAME, SURNAME:

For example:

0693p00000AGtS9AAL.jpg

0693p00000AGtSJAA1.jpg

And my expected output should be:

0693p00000AGtSOAA1.jpg

Is there a way i can achieve this guys?

Many thanks for your help.

Best regards,

Duke

Labels (3)
5 Replies
Anonymous
Not applicable

@Rohit Aftab​ , use tMemorizeRow to cache the last amount value and use current amount to subtract last amount to the new amount for each row, finally, use a tAggregateRow to perform aggregation operation and get the row with the highest sequence for each group.

0693p00000AGxuNAAT.png0693p00000AGxv0AAD.png0693p00000AGxulAAD.png 

Hope it helps you!

 

Regards

Shong

RA6
Creator
Creator
Author

Hello @Shicong Hong​ 

 

Many thanks for your response.

Can you attach me the example job please?

 

Thank you.

 

Best regards,

Duke

Anonymous
Not applicable

see attachment, the example job is export from Talend Enterprise Studio 7.3.1

RA6
Creator
Creator
Author

@Shicong Hong​  Is this possible to achieve this one? This is when you have more than 2 combination. 0693p00000AYfinAAD.jpg 

 

 

 

Anonymous
Not applicable

Yes, try this expression on tMap: (assuming the data type of amt field is int/integer)

amount_tMemorizeRows_1[1]==null?0:row2.amount-amount_tMemorizeRows_1[1]

and then, use tFilterRow after tMap to remove the rows that the amt value is 0.