Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

yelin_nyu
Not applicable

load data with latest date

Hi,

it's kind of a miss or hit thing. sometimes it works and other times it doesn't.

I need to find values with latest date. I usually use this method, but it's too long. Any good suggestion to make my life easier? thanks

P;

sql select distinct load_date from tbl1;

P2:

load max(load_date) as MaxDate

resident P;

let vMaxD = peek('MaxDate', 0, 'P')

drop table P;

drop table P2;

Rtble:

sql select * from tbl1

where load_date ='$(vMaxD)';

Tags (2)
1 Solution

Accepted Solutions
jagan
Not applicable

Re: load data with latest date

Hi,

Try this

P:

sql select Max(load_date) from tbl1;

let vMaxD = peek('MaxDate', 0, 'P')

drop table P;

Rtble:

sql select * from tbl1

where load_date ='$(vMaxD)';

Hope this helps you.

Regards,

Jagan.

3 Replies
jagan
Not applicable

Re: load data with latest date

Hi,

Try this

P:

sql select Max(load_date) from tbl1;

let vMaxD = peek('MaxDate', 0, 'P')

drop table P;

Rtble:

sql select * from tbl1

where load_date ='$(vMaxD)';

Hope this helps you.

Regards,

Jagan.

jason_michaelid
Not applicable

Re: load data with latest date

Maybe just move the Max() into the first SQL statement?

P:

Load

   load_date

;

sql select max(load_date) from tbl1;

let vMaxD = peek('load_date')

drop table P2;

 

Rtble:

sql select * from tbl1

where load_date ='$(vMaxD)';

jason_michaelid
Not applicable

Re: load data with latest date

Oops - not sure why I didn't see Jagan's answer there already!