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: 
Not applicable

Peek or macros?

Hello!

Guys please help me solve the problem,

I have a table:

I need to leave the row with the latest month before the value of the Bench field appears. Like I have in June-15 '1' in DataAccount and zero in Benh, in Jul-15 I dont have any data in DataAccount, but I have '1' in bench. So I need Qlikview to leave me the row with Jun-15 data.

So the table should look like:

1.png

Please Help!

2 Replies
Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Try this in your load

Final:

Load

*

,if(previous(Employee)=Employee AND Bench <> 0, DataAccount) as Flag

RESIDENT Temp_Table;

Drop Table Temp_Table;


hic
Former Employee
Former Employee

An alternative method, where you always get the last record with Bench=0 could be the following

//=========== Load table

tmp:

Load * From Source;

//=========== Sort table backwards, and run one more pass

Data:

Load *,

     If( Bench=0 and Peek(Bench)=1, True(), False()) as Flag

Resident tmp

     Order By Employee, Period Desc;

Drop Table tmp;

HIC