Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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