Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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.

vinay_bangari
Not applicable

how to flag month end using peek function

hi May be i am asking a silly question. I would like to flag last date in each month either using peek function or in any other way is script.

1 Solution

Accepted Solutions
vinay_bangari
Not applicable

Re: how to flag month end using peek function

load Max([Stock Plan Date]) as LastDayMonth, ITEM_ID

Group By ITEM_ID, Year([Stock Plan Date]), Month([Stock Plan Date]);

In this script we have to include month and Year as well otherwise , it will give us the maximum date for each Item...Hope this is correct.

6 Replies
vinay_bangari
Not applicable

Re: how to flag month end using peek function

sorry forgot to attach the QVW file.

konstantin
Not applicable

Re: how to flag month end using peek function

if(MonthEnd([Stock Plan Date]) = [Stock Plan Date], 'Y', 'N') as MonthEndFlag

vinay_bangari
Not applicable

Re: how to flag month end using peek function

Hi Kozins,

Looks like monthend will give me exact month end i guess. I applied above script, it is N for all the dates. In my data my month end would be sometimes 28th or 29 th, 27 as well. not necessarily 30 or 31....

konstantin
Not applicable

Re: how to flag month end using peek function

something lik this:

App:

LOAD [Stock Plan Date] as date,

     AVAIL_INV_QTY,

     ITEM_ID

FROM

(biff, embedded labels, table is Sheet1$);

inner join

load Max([Stock Plan Date]) as LastDayMonth, ITEM_ID

Group By ITEM_ID, Year([Stock Plan Date]), Month([Stock Plan Date]);

App2:

Load *,

if ([Stock Plan Date] = LastDayMonth, 'Y', 'M') as LastDayFlag

Resident App;

Drop Table app;

vinay_bangari
Not applicable

Re: how to flag month end using peek function

i was just about to paste the solution. Thanks for your help..i got the same idea..

vinay_bangari
Not applicable

Re: how to flag month end using peek function

load Max([Stock Plan Date]) as LastDayMonth, ITEM_ID

Group By ITEM_ID, Year([Stock Plan Date]), Month([Stock Plan Date]);

In this script we have to include month and Year as well otherwise , it will give us the maximum date for each Item...Hope this is correct.