Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

need help in expression

For selected date if the values is not available then get previous nearest date value.

How to achieve this?

Reards,

Prajna

5 Replies
tresesco
MVP
MVP

You can get that using peek() in the script. Have a look here: Generating Missing Data In QlikView

MK_QSL
MVP
MVP

Use of Previous/Peek function you can replace the Null Data with previous one.

If you share your sample file or apps, we can help you in better way.

Not applicable
Author

well the requirement is i need to show balance or that particular day.if there is no balance available the i should consider previous day balance.

Say apr 14 we have balance ,apr 15 we have,ap 18 we have

so now apr 16 and 17 should have 15 data(balance)

balance needs to be carried forwad.

Regards,

Prajna

MK_QSL
MVP
MVP

Sample Script enclosed...

======

TempTable:

LOAD Item, Date, IF(Len(Trim(Balance))=0,Null(),Balance) as Balance Inline

[

  Item, Date, Balance

  A, 01/10/2010, 100

  A, 02/10/2010, 10

  A, 03/10/2010,

  B, 24/10/2010, 150

  B, 25/10/2010,

  B, 26/10/2010, 80

];

Table:

NoConcatenate

Load

  If(IsNull(Item),Peek(Item),Item) as Item,

  Date,

  If(IsNull(Balance), Peek(Balance), Balance) as Balance

Resident TempTable

Order By Date;

Drop Table TempTable;

=======

rajat2392
Partner
Partner

A little modification needed in Manish's script

====

TempTable:

LOAD Item, Date, IF(Len(Trim(Balance))=0,Null(),Balance) as Balance Inline

[

  Item, Date, Balance

  A, 01/10/2010, 100

  A, 02/10/2010, 10

  A, 03/10/2010,

  B, 24/10/2010, 150

  B, 25/10/2010,

  B, 26/10/2010, 80

];

Table:

NoConcatenate

Load

  If(IsNull(Item),Peek(Item),Item) as Item,

  Date,

  If(IsNull(Balance),If(Item=Peek(Item),Peek(Balance),0), Balance) as Balance

Resident TempTable

Order By Date;

Drop Table TempTable;

=======

Else if the first row of customer B has no Balance value, it will take the previous balance value which is for A, so it will go wrong.