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: 
yelin_nyu
Creator
Creator

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)';

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

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.

View solution in original post

3 Replies
jagan
Partner - Champion III
Partner - Champion III

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_Michaelides
Partner - Master II
Partner - Master II

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_Michaelides
Partner - Master II
Partner - Master II

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