Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
alexandermllr
Contributor

Re: Qlikview - Fill data only between

I works, but not always.

I forgot something, 1 Key can have more different data:

KeyDate

Field 2

123401.01.2018
123402.01.2018Data 1
123403.01.2018
123404.01.2018
123405.01.2018Data 1
123406.01.2018
123407.01.2018Data 2
123408.01.2018
123409.01.2018Data 2
1234

10.01.2018

I would need the table to be like this:

KeyDate

Field 2

123401.01.2018
123402.01.2018Data 1
123403.01.2018Data 1
123404.01.2018Data 1
123405.01.2018Data 1
123406.01.2018
123407.01.2018Data 2
123408.01.2018Data 2
123409.01.2018Data 2
1234

10.01.2018

Re: Qlikview - Fill data only between

Try this

Table:

LOAD * INLINE [

    Key, Date, Field 2

    1234, 01.01.2018,

    1234, 02.01.2018, Data 1

    1234, 03.01.2018,

    1234, 04.01.2018,

    1234, 05.01.2018, Data 1

    1234, 06.01.2018,

    1234, 07.01.2018, Data 2

    1234, 08.01.2018,

    1234, 09.01.2018, Data 2

    1234, 10.01.2018

];


TempTable:

NoConcatenate

LOAD Key,

Date,

[Field 2],

If(Len(Trim([Field 2])) = 0, Peek('Field 2 New'), [Field 2]) as [Field 2 New]

Resident Table

Order By Key, Date;


DROP Table Table;


Left Join (TempTable)

LOAD Key,

[Field 2] as [Field 2 New],

Max(Date) as MaxDate,

Min(Date) as MinDate

Resident TempTable

Where Len(Trim([Field 2])) > 0

Group By Key, [Field 2];


FinalTable:

LOAD Key,

Date,

If(Date >= MinDate and Date <= MaxDate, [Field 2 New]) as [Field 2]

Resident TempTable

Order By Key, Date;


DROP Table TempTable;