Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

WeekNum required as w1,w2,w3,w4..Week Starts From Tuesday to Monday.

tuewedthufrisatsunmonweeknum
25-04-201726-04-201727-04-201728-04-201729-04-201730-04-201701-05-2017w1
02-05-201703-05-201704-05-201705-05-201706-05-201707-05-201708-05-2017w2
09-05-201710-05-201711-05-201712-05-201713-05-201714-05-201715-05-2017w3
16-05-201717-05-201718-05-201719-05-201720-05-201721-05-201722-05-2017w4
23-05-201724-05-201725-05-201726-05-201727-05-201728-05-201729-05-2017w5
30-05-201731-05-201701-06-201702-06-201703-06-201704-06-201705-06-2017w1
1 Solution

Accepted Solutions
devarasu07
Master II
Master II

Hi,

Try to use HIC suggestion (redefine week num)

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

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

     Set vCal_RD = 4; // Reference day = This day in Jan defines week one {1..7}

Load *,

          Div( Date - WeekStart( WeekYearRefDate, 0, $(vCal_FD) ) + 7, 7 ) as WeekNumber,

          Year( WeekYearRefDate ) as WeekYear;

     Load *,

          Date( YearStart( If( $(vCal_BW), Date, WeekRefDate )) + $(vCal_RD) - 1) as WeekYearRefDate ;

     Load *,

          Date( WeekStart( Date, 1, $(vCal_FD) ) - $(vCal_RD) ) as WeekRefDate ;

Redefining the Week Numbers

Capture.JPG

View solution in original post

1 Reply
devarasu07
Master II
Master II

Hi,

Try to use HIC suggestion (redefine week num)

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

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

     Set vCal_RD = 4; // Reference day = This day in Jan defines week one {1..7}

Load *,

          Div( Date - WeekStart( WeekYearRefDate, 0, $(vCal_FD) ) + 7, 7 ) as WeekNumber,

          Year( WeekYearRefDate ) as WeekYear;

     Load *,

          Date( YearStart( If( $(vCal_BW), Date, WeekRefDate )) + $(vCal_RD) - 1) as WeekYearRefDate ;

     Load *,

          Date( WeekStart( Date, 1, $(vCal_FD) ) - $(vCal_RD) ) as WeekRefDate ;

Redefining the Week Numbers

Capture.JPG