Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted

Re: Using a field to populate a new field

Hi,

one solution could be:

QlikCommunity_Thread_181709_Pic1.JPG

table1:

LOAD TargetSymbol,

    StageDesignation,

    StageOrde,

    StageStartDate

FROM [https://community.qlik.com/thread/181709] (html, codepage is 1252, embedded labels, table is @1)

Where Len(TargetSymbol);

Left Join (table1)

LOAD TargetSymbol,

    StageStartDate,

    If(TargetSymbol=Previous(TargetSymbol),Date(Previous(StageStartDate)-1)) as StageFinishDate

Resident table1

Order By TargetSymbol, StageStartDate desc;

hope this helps

regards

Marco

Not applicable

Re: Using a field to populate a new field

Hey Oleg,

Soooooo close - now I am getting the correct date, but also the startdate of the same stage as well.

Load

*,

   
if(TargetSymbol=Peek(TargetSymbol), date(Previous(StageStartDate)-1, 'M/D/YYYY'), null()) as StageFinishDate

Resident

TargetDBLoad

order by TargetSymbol, StageStartDate desc;



drop table TargetDBLoad;

error3.jpg

Not applicable

Re: Using a field to populate a new field

When I put the following in, to make sure it was not comparing same stage to same stage - it seems to fix it.

Load

*,

   
if(TargetSymbol=Peek(TargetSymbol) and StageDesignation<>peek(StageDesignation), date(Previous(StageStartDate)-1, 'MM/DD/YYYY')) as StageFinishDate

Resident

TargetDBLoad

order by TargetSymbol, StageStartDate desc;



drop table TargetDBLoad;