Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Stuck on Make date Mid Function to get Monthstart and Monthend

Hi friends,Have a Nice Day Can any one please help on below logic

I have a Column with name Period Consists of Date as 201409=>Here Format is YYYYMM (2014(YYYY),09(MM))

I'm Trying to Incorporate the Make date function to Get Month Start,Month End for Associations 0n Period Column

But Fail to achieve this File Not Found Period Like Error showing But Values are Present in above format.

Temp:

LOAD Period,

MakeDate(mid(Period,1,4),Right(Period,2),'01') as Monthstart,   

     MakeDate(mid(Period,1,4),Right(Period,2),

     IF(Right(Period,2)='01','31',

        if(Right(Period,2)='02','28',

        if(Right(Period,2)='03','31',

        if(Right(Period,2)='04','30',

        if(Right(Period,2)='06','30',

        if(Right(Period,2)='07','31',

        if(Right(Period,2)='08','31',

        if(Right(Period,2)='09','30',

        if(Right(Period,2)='10','31',

        if(Right(Period,2)='11','30',

        if(Right(Period,2)='12','31',

        if(Right(Period,2)='05','31','01'))))))))))))) as Monthend

Resident [Check];

Need to Achieve This Period,Monthstart,Monthend

3 Replies
nagaiank
Specialist III
Specialist III

Use the script below

Data:

LOAD *,MonthStart(Date) as MonthStartDate, MonthEnd(Date) as MonthEndDate;

LOAD *,MakeDate(Left(Period,4),Right(Period,2),1) as Date;

LOAD * Inline [

Period

201401

201402

];

MarcoWedel

LOAD *,

          DayName(MonthEnd(MonthStartDate)) as MonthEndDate;

LOAD Period,

          Date#(Period,'YYYYMM') as MonthStartDate

Inline [

Period

201401

201402

];

Anonymous
Not applicable
Author

Hi,

Try:

Data:
LOAD * Inline
[
Period
201401
201402
201403
]
;

LOAD *,
MonthStart(Date) as MonthStartDate,
MonthEnd(Date) as MonthEndDate;
LOAD *,Date#(Period,'YYYYMM') as Date
Resident Data;

Date.png

Regards

Neetha