Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ajithsachin
Partner - Contributor II
Partner - Contributor II

Month end records from a resident table

Dear All,

           I have a resident table like below.

TEMP:          

ItemDateRate
Item101-01-201510
Item101-15-201511
Item101-31-201510.5
Item201-01-201520
Item201-15-201521
Item201-31-201520.5

from this TEMP table i need to load only month end records.

Regards,

Ajith

3 Replies
Anonymous
Not applicable

TEMP:

load

  *

where floor(MonthEnd(Date))  = num(Date)

;

LOAD Item,

    date(date#(Date,'MM-DD-YYYY')) as Date ,

    Rate

FROM

[https://community.qlik.com/thread/160749]

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

;

Data:

NoConcatenate

load

  *

resident TEMP

where floor(MonthEnd(Date))  = num(Date)

;

drop table TEMP ;

Anonymous
Not applicable

A shorter version:

TEMP

...

;


INNER KEEP (TEMP) LOAD
date(max(Date),'MM-DD-YYYY') as Date
RESIDENT TEMP
GROUP by floor(MonthEnd(Date));

maxgro
MVP
MVP

another one with peek


temp:

LOAD Item,

    Date,

    Rate

FROM

[https://community.qlik.com/thread/160749]

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

// some other data to test

Concatenate (temp) load * inline [

Item,      Date,      Rate

Item2, 03-01-2015, 14

Item2, 03-15-2015, 13

Item2, 03-31-2015, 12

];

final:

NoConcatenate load *

Resident temp

where Item<>Peek(Item) or year(Date)&num(Month(Date),'00') <> year(Peek(Date)) & num(Month(peek(Date)),'00')

order by Item, Date desc;

DROP Table temp;