Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have a small requirement to calculate the week numbers with Sunday as Start week and also want to limit the week number to 52 at any point. Any idea how we can achieve this?
I did try the below script, but I get week number 53 for 2010 and 2016. My requirement is to limit week number to 52 and start the next week from 1 instead. Kindly help me with this.
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}
Set vCal_RD = 4; // Reference day = This day in Jan defines week one {1..7}
Load *,
Div( TheDate - WeekStart( WeekYearRefDate, 0, $(vCal_FD) ) + 7, 7 ) as FiscalWeekID,
Year( WeekYearRefDate ) as WeekYear;
Load *,
Date( YearStart( If( $(vCal_BW), TheDate, WeekRefDate )) + $(vCal_RD)-1) as WeekYearRefDate ;
Load *,
Date( WeekStart( TheDate, 1, $(vCal_FD) ) - $(vCal_RD) ) as WeekRefDate
;
Thank you.
Any help on how this can be achieved?