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: 
regowins
Creator II
Creator II

Add a Month and Week index to Master Calendar

Hi, is there a quick way to add a month and week index to the below master calendar ? For now i only have the date index but I would like to add a month and week index.

TempCalendar:

LOAD
$(varMaxDate) - RowNo() +1 as DateNumber,
Date($(varMaxDate) - RowNo() + 1) as TempDate,
RowNo() as dateIndex
AutoGenerate 1
While $(varMinDate) + IterNo()-1<= $(varMaxDate);

Thanks for the help!

5 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi Ashwin,

Try this

TempCalendar:

LOAD

     *,

     Month(TempDate) AS Month,

     Week(TempDate) AS Week;

LOAD
$(varMaxDate) - RowNo() +1 as DateNumber,
Date($(varMaxDate) - RowNo() + 1) as TempDate,
RowNo() as dateIndex
AutoGenerate 1
While $(varMinDate) + IterNo()-1<= $(varMaxDate);


Regards,

Jagan.

Not applicable

Try with Month & Week functions in the script.

regowins
Creator II
Creator II
Author

Hi Jagan,

Yes, I already have this setup. I was looking for a sequential index with out it being reset in a new year. With current method I would only get 52 weeks for every year. i would like the index to continue on past 52 weeks for the date range. I hope that makes sense. I think I may have to create a separte calendar using  autogenerate.

hic
Former Employee
Former Employee

You should not create a new table for this. There are many ways to create sequential numbers inside existing master calendar, e.g.

12*Year(Date) + Month(Date) as SeqMonth

MonthStart(Date) as MonthStartDate

Div(Date,7) as SeqWeekNumber

HIC

regowins
Creator II
Creator II
Author

Thanks! I did not think of this.