Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

To create month period that start from Feb 20-Mar 19 = Month 1

Hi,

I have to create month period field that starts from

Feb 20, 2009-Mar 19, 2009 = Month 1

Mar 20, 2009-Apr 19, 2009 = Month 2

Apr 20, 2009-May 19, 2009 = Month 3

May 20, 2009-Jun 19, 2009 = Month 4

Jun 20, 2009-Jul 19, 2009 = Month 5

Jul 20, 2009-Aug 19, 2009 = Month 6

Aug 20, 2009-Sep 19, 2009 = Month 7

Sep 20, 2009-Oct19, 2009 = Month 8

Oct 20, 2009-Nov 19, 2009 = Month 9

Nov 20, 2009-Dec 19, 2009 = Month 10

Dec 20, 2009-Jan 19, 2010 = Month 11

Jan 20, 2010-Feb19, 2010= Month 12

What should I do for this case? I have tried to do if-else but it doesnt work. Also, attached my dateIsland.qvw to create master calendar. Please help me

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Tawin,

If you have fields DateId and Day in your calendar (table Date), add this script:

LEFT JOIN (Date) LOAD

DateId,

'Month ' &

  if(Day<=19,

  num(month(addmonths(DateId,-2))),

  num(month(addmonths(DateId,-1)))) as ModifiedMonth

RESIDENT Date;

And, see attached.

Regards,

Michael

View solution in original post

3 Replies
edg_baltazar
Partner - Creator
Partner - Creator

A fast way to do this is to create a table in excel containing the next fields... master_date and alternative_month, fill master_date field with all dates of the year and fill alternative_month with the corresponding new value of month then load this excel into qlikvew and make a left join to the master calendar with this new table , now your master_calendar will have a new field called alternative_month where you are going to have this new month that you want, regards!

Anonymous
Not applicable
Author

Tawin,

If you have fields DateId and Day in your calendar (table Date), add this script:

LEFT JOIN (Date) LOAD

DateId,

'Month ' &

  if(Day<=19,

  num(month(addmonths(DateId,-2))),

  num(month(addmonths(DateId,-1)))) as ModifiedMonth

RESIDENT Date;

And, see attached.

Regards,

Michael

Not applicable
Author

It rocks, thank you very much