Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
MauriceLudo
Creator II
Creator II

Number week 1 01/01/2017

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

10 Replies
YoussefBelloum
Champion
Champion

what do you want to do ?

Display week numbers instead of Dates ?

MauriceLudo
Creator II
Creator II
Author

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

YoussefBelloum
Champion
Champion

can you share your app ? or sample data ?

MauriceLudo
Creator II
Creator II
Author

here is the app

erjohnso
Creator
Creator

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;

shraddha_g
Partner - Master III
Partner - Master III

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 ;

MauriceLudo
Creator II
Creator II
Author

the  WeekRefDate  field corresponds to what exactly??

MauriceLudo
Creator II
Creator II
Author

I do not understand why 01/01/2017 is week 48

shraddha_g
Partner - Master III
Partner - Master III

Try this in Calendar

Ceil((TempDate - WeekStart(YearStart(TempDate),0,0)+1)/7) as WeekNumber