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

Hi! I need to populate a table with the year,month, week number of the year ( 1-52), week start and week end dates.

I have used the following code: 

Set vCal_FD = 6; // First Day of the week {0=Mon, 1=Tue, ... , 6=Sun}

Set vCal_BW = 0; // Broken Weeks allowed {0=No, 1=Yes}

tabCalendar:   

LOAD    

     Day(Date) as Day,   

     WeekDay(Date) as WeekDay,  

     WeekStart(Date,0,5) as WeekStartDate,

     WeekEnd(Date, 0, 5) as WeekEndDate,

     Week(Date) as Week, 

     AutoNumber(Week(Date),Year(Date)) as Week2, 

     WeekName(Date) as WeekName,   

     Month(Date) as Month,   

     MonthName(Date) as MonthName,   

     Dual('Q'&Ceil(Month(Date)/3),Ceil(Month(Date)/3)) as Quarter,   

     QuarterName(Date) as QuarterName,   

     Year(Date) as Year,   

     WeekYear(Date) as WeekYear;     

LOAD Date(MinDate+IterNo()-1) as Date   

While MinDate+IterNo()-1 <= MaxDate;   

LOAD MakeDate(2010) as MinDate,   

     Today() as MaxDate   

AutoGenerate 1; 

But the when populating the table with year, month,week it's fine.. weeks 1-52. BUT as soon as I add the week start date.. the values are duplicated.  can anybody help me please ?

I also want to use another month as the first month of the year.. for ex.

Jun 4, 2017

..must be the the first week ( week number 1)

0 Replies