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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Micki
Creator
Creator

Check the last and previous values in column

Hi Folks, 

Have a table:

IDOutcome 
1Not Run
2Passed
3Passed
4Not  Run
5Not Run
6Not Run
7Not Run

 

I need to check if last Outcome was Not Run, then i need to avoid those rows and select Passed with ID: 3 (in that case it was the latest Passed

and final result: 

IDOutcome 
1Not Run
2Passed
3Passed

 

To summarize i need to check based from the last outcome and select any that are not  [Not Run]

3 Replies
Kushal_Chawda

@Micki  what is the criteria to check last outcome? Is there any Date or something?

Micki
Creator
Creator
Author

@Kushal_Chawda , by ID only, so it's like  going upward, script should check if ID - Not Run then upward, until the first not - Not Run value appears 

MayilVahanan

Hi @Micki 

Try like below to get the  Ids upto the latest Passed information

Table:
Load *, RowNo() as Row Inline
[
ID,Outcome
1,Not Run
2,Passed
3,Passed
4,Not Run
5,Not Run
6,Not Run
7,Not Run
8,Not Run
];

MaxTemp:
Load Max(Row) as MaxRow Resident Table where Outcome = 'Passed';

Let vMaxRow = Peek('MaxRow');

NoConcatenate
Load * Resident Table where Row <= $(vMaxRow);

DROP Table Table, MaxTemp;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.