Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
alexandermllr
Creator
Creator

Qlikview - Fill data only between

Hello,

I need to fill the data, only when it's between the same data.

KeyDate

Field 2

123401.01.2018
123402.01.2018Data 2
123403.01.2018
123404.01.2018
123405.01.2018Data 2
123406.01.2018

Final Table should be this, in order by Key, Date

KeyDate

Field 2

123401.01.2018
123402.01.2018Data 2
123403.01.2018Data 2
123404.01.2018Data 2
123405.01.2018Data 2
123406.01.2018

With my script everything is filled with the last value.

Can someone help me?

Thanks

11 Replies
alexandermllr
Creator
Creator
Author

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

sunny_talwar

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;