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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get the most recent data?

Hi All,

I have a requirement where I need to get the most recent data if the date is null. I have to achieve this in script. Please find below the sample data

Key     Date

001     24/04/2015

002     25/04/2015

-          -

003     26/04/2015

004     25/04/2015

-          -

-          -

-          -

005     29/04/2015

Expected:

Key     Date

001     24/04/2015

002     25/04/2015

002     26/04/2015

003     26/04/2015

004     25/04/2015

004     26/04/2015

004     27/04/2015

004     28.04/2015

005     29/04/2015

2 Replies
sunny_talwar

May be like this?

Table:

LOAD id,

  Key as TempKey,

  Date as TempDate;

LOAD * Inline [

id, Key,     Date

1, 001,     24/04/2015

2, 002,     25/04/2015

3, ,

4, 003,     26/04/2015

5, 004,     25/04/2015

6, ,

7, ,

8, ,

9, 005,     29/04/2015

];

FinalTable:

LOAD id,

  If(Len(Trim(TempKey)) = 0, Peek('Key'), TempKey) as Key,

  Date(If(Len(Trim(TempDate)) = 0, Peek('Date') + 1, TempDate)) as Date

Resident Table

Order By id;

DROP Table Table;


Capture.PNG

Kushal_Chawda

How You are getting the Blank values for both Key and date?  Your Key values should not be blank.