Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sneha2907
Contributor
Contributor

how to know previous batch_id

Hi All,

 

if my max batch_id is 23 and i wants to compare it with previous batch id then how to get previous batch id as numbers are not consecutive.eg if my previous batch id is 17.

2 Replies
sugathirajkumar
Creator
Creator

use peek or previous function 

Anil_Babu_Samineni

Try this way

Table1:
Load batch_id From Table;

Max_Batch_Table:
Load Max(batch_id) as Max_Batch Resident Table1;

Let vMaxID = Peek('Max_Batch_Table', -1, 'Max_Batch');

Final:
NoConcatenate
Load If(Previous(batch_id)=$(vMaxID), 1,0) as flag, batch_id resident Table1;

Drop Table Table1;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful