Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
danaleota1
Creator
Creator

Can I use the Peek Function where there is a where clause

Hello I am trying to do a counter that begins again with each new dimension value.  Here is part of my script:

'let vCount = 1;

if(rowno() = 1 or MonthStart - peek(MonthStart) > 120 or MonthStart - HIRE_DATE < 120,
'$(vCount)',
if(LOGIN_ID = peek('LOGIN_ID'),
'$(vCount)' + peek('LIST_COUNT'),
'$(vCount)' )) as LIST_COUNT,'

However in this table there is also a where clause that excludes some rows under certain conditions so the LIST_COUNT will sometimes have a value of 2 when I expect a 1.  It looks like the 1 is being assigned to a row that is excluded in the where clause.  Does Peek() ignore data that is excluded in a where clause?  Is there a different function I should be doing instead.  Note I also tried Previous().  For a count that resets with each dimension value that takes into account exclusions because of a where clause is there a better approach to this? 

 

Thanks!

1 Reply
rbartley
Specialist II
Specialist II

Hi,

I'm not sure if I completely understand your question, but my interpretation is that you want your peek to include the where clause in the load statement.  if so, don't include the peek in that LOAD block, but add another instead, e.g.

 

[tableA]:

LOAD

....

where x=y;

join([tableA] )

LOAD

...

peek(.....)

resident [tableA];