Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Peek Function

Hi All,

For the peek function to work, does my data have to be already sort, or can I build some sorting code into my load statement. I am having some difficulty with the following code, which is producing various Peek values for the same customer, where it should only be producing one value:

[BALES LOOP]:

LOAD //[Fieldworker Name],

     [Submission Id],

     //[Fieldworker Id],

     //[Repeats On Question],

     //[Repeat Question Value],

     //[Repeating Index],

     Date(Floor([Received Date]),'DD.MM.YYYY') as [Received Date],

     'V'& TIMB as TIMB,

     Bales as [Bales Loaded]

FROM

(ooxml, embedded labels, table is [2 Bale Loop]);

[BALE LOOP]:

NoConcatenate LOAD

    //[Fieldworker Name],

    [Submission Id],

     //[Fieldworker Id],

     //[Repeats On Question],

     //[Repeat Question Value],

     //[Repeating Index],

     [Received Date],

     TIMB,

     if(previous(TIMB)=TIMB,peek([Received Date]),[Received Date])as [Last Pickup],

     [Bales Loaded]

    

    Resident [BALES LOOP]

    Order by TIMB,[Received Date];

    

    DROP Table [BALES LOOP];

Can anyone assist.

Thanks

Herbert

3 Replies
MK_QSL
MVP
MVP

try

Peek('[Received Date]')

or try

if(previous(TIMB)=TIMB,Previous([Received Date]),[Received Date])as [Last Pickup],


UPDATE : Please check enclosed file..

maxgro
MVP
MVP

[BALES LOOP]:

...

....

[BALE LOOP]:

NoConcatenate

load

     [Submission Id],

     [Received Date],

     TIMB,

    if(peek(TIMB)<>TIMB, [Received Date], Peek([Received Date])) as [Last Pickup],

     [Bales Loaded]

    Resident [BALES LOOP]

order by TIMB,  [Received Date] desc;

DROP Table [BALES LOOP];

Nicole-Smith

There could be other problems with your code, but the peek function needs to include the field name without brackets but within single quotes:

peek('Received Date')