Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I come back to you about week number, I would like to know that it is the best solution to always count on 01/01/2017 in the week number 1.
Here is a screenshot
Best regards
Maurice
what do you want to do ?
Display week numbers instead of Dates ?
I would like to calculate the number of week of the year and I would like him to consider the 1st of January always in the week number 1
can you share your app ? or sample data ?
here is the app
Create a table with week and week number using distinct, order by, autonumber and resident load:
WeekNumber:
Load Distinct
[WeekNumber Date de création Objet],
AutoNumber([WeekNumber Date de création Objet]) as WeekNum
RESIDENT Test_PilotageN2
Order By Y [WeekNumber Date de création Objet] ASC;
Refer Redefining the Week Numbers
Try below code:
Let vCal_FD = 0; // First Day of the week {0=Mon, 1=Tue, ... , 6=Sun}
Let vCal_BW = 0; // Broken Weeks allowed {0=No, 1=Yes}
Let vCal_RD = 1; // Reference day = This day in Jan defines week one {1..7}
Load
*,
if(TempDate < WeekRefDate and WeekNumber=0 and year(TempDate)<WeekYear,53,WeekNumber+1) as Actual_WeekNumber;
Load *,
Div( TempDate - WeekStart( WeekYearRefDate, 1, $(vCal_FD) ) + 7, 7 ) as WeekNumber,
Year( WeekYearRefDate ) as WeekYear;
Load *,
Date( YearStart( If( $(vCal_BW), TempDate, WeekRefDate )) + $(vCal_RD) - 1) as WeekYearRefDate ;
Load *,
Date( WeekStart( TempDate , 1, $(vCal_FD) ) - $(vCal_RD) ) as WeekRefDate ;
the WeekRefDate field corresponds to what exactly??
I do not understand why 01/01/2017 is week 48
Try this in Calendar
Ceil((TempDate - WeekStart(YearStart(TempDate),0,0)+1)/7) as WeekNumber