Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

pauljohansson
Contributor III

Propagate values downwards

Hi all happy Qlikview people,

I have a seemingly easy problem that i don't manage to solve.I want to populate the LastActiveWeek column downwards. I have been looking at Peek(). But since its impossible prehand to know how many rows I need to go back and check I cant get it to work.


Starting Point:

RegistrationDate

Customer WeekDate LastActiveWeek
2015-01-01794955011
2015-01-0179495502
2015-01-01794955033
2015-01-0179495504
2015-01-01794955055
2015-01-0179495506
2015-01-0179495507
2015-01-017949550

8

2015-01-0179495509
2015-01-01794955010

Goal:

RegistrationDate

CustomerWeekDateLastActiveWeek
2015-01-01794955011
2015-01-01794955021
2015-01-01794955033
2015-01-01794955043
2015-01-01794955055
2015-01-01794955065
2015-01-01794955075
2015-01-017949550

8

5
2015-01-01794955095
2015-01-017949550105

What would the recommended technique be? Any guidance or ideas are very much appreciated.

Thanks in advance,

Br

Paul

Message was edited by: Paul Johansson

Tags (3)
1 Solution

Accepted Solutions

Re: Propagate values downwards

Hey Paul,

This is the output from your data

So, Peek is going to fill in all the cells which are empty with the last given value above it.

HTH

Best,

S

8 Replies
mov
Esteemed Contributor III

Re: Propagate values downwards

Se attached, the script is quite simple.

Re: Propagate values downwards

Table:

LOAD RegistrationDate,

     Customer,

     WeekDate,

     LastActiveWeek

FROM

[http://community.qlik.com/thread/151302]

(html, codepage is 1252, embedded labels, table is @1);

Table1:

NoConcatenate

LOAD RegistrationDate,

     Customer,

     WeekDate,

     If(Len(Trim(LastActiveWeek)) = 0, Peek('LastActiveWeek'), LastActiveWeek) as LastActiveWeek

Resident Table;

DROP Table Table;

Hope this helps

Best,

S

pauljohansson
Contributor III

Re: Propagate values downwards

Hi Michael,

Thanks for your reply.


If you check my table, you see that there sometimes might be several rows without any value:

2015-01-01794955055
2015-01-0179495506
2015-01-0179495507
2015-01-017949550

8

2015-01-0179495509
2015-01-01794955010

A Peek would result in:

2015-01-01794955055
2015-01-01794955065
2015-01-0179495507
2015-01-017949550

8

2015-01-0179495509
2015-01-01794955010

leaving most of the rows empty,

br

Paul

pauljohansson
Contributor III

Re: Propagate values downwards

Hi Sunindia,

Thanks for your reply.

If you check my starting point table you see that there sometimes are several rows that are empty. So Peek the previous row will not solve the problem.


br

Paul

Re: Propagate values downwards

Hey Paul,

This is the output from your data

So, Peek is going to fill in all the cells which are empty with the last given value above it.

HTH

Best,

S

mov
Esteemed Contributor III

Re: Propagate values downwards

So is in my example.  You've missed something in your script, I assume.

delmak2000
Contributor

Re: Propagate values downwards

Hello, Sunny.....Can't seem to find the solution u provided to Paul....Pls help....

My case is a little bit similar.....

I want to propagate the last value if though the date for that data doesn't exist.

Thanks

Re: Propagate values downwards

Do you have a sample you can share?

Community Browser