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: 
Not applicable

wrong week() format

Hi,
also If I use
date#(week( posting, 'DD/MM/YYYY')) as posting

the result is this:

posting

weekly

03/01/2010

53

02/01/2010

53

01/01/2010

53

01/01/2012

52

02/01/2011

52

01/01/2011

52

the week are wrong.. some help?
Many thanks.
Regards.

1 Solution

Accepted Solutions
Not applicable
Author

Correct:

IF (

        (DayNumberOfYear(posting)) < 7

         and week(posting) > 2

        , 1 ,    

         week(date#( posting, 'DD/MM/YYYY')))  as weekly ,

View solution in original post

7 Replies
sivarajs
Specialist II
Specialist II

Hi,

Check the date format which you are using

and try with some other dates bcoz 1st week of the year may fall in pevious year week

Sivaraj S

sivarajs
Specialist II
Specialist II

some ex which i have tried

PostingWeek
1/1/201053
2/1/201053
3/1/201053
4/1/20101
5/1/20101
6/1/20101

ist jan 2010 starts with last week of previous year

Sivaraj S

Not applicable
Author

Right. Number of some <7 first days are in last week. Try to use expression like:

IF ( DayNumberOfYear(posting) < 7 and week(posting) > 2,

     1,

     date#(week( posting, 'DD/MM/YYYY'))

)

if ( MyEnglish == Bad ) {

     Sorry;

}

Not applicable
Author

To force in this way is a solution???

But, dos this problem is a a QV  bug?

For the future week() statement I will put always the forced value?

Not applicable
Author

Sivaraj Seeman:

Why u use WeekStart(Posting) ?

Dnt see a reson for it.

k_l_a:

To force in this way is a solution???

But, dos this problem is a a QV  bug?

For the future week() statement I will put always the forced value?

Its a solution for your request. U will force only week number of first 7 days, when they are in last week of previous year, if you dnt like normal state. When 1st junary at last week of previous year its normal state. dnt confuse with it. ))

IF ( DayNumberOfYear(posting) < 7 and week(posting) > 2,

     1,

     date#(week( posting, 'DD/MM/YYYY'))

)

Not applicable
Author

I have to put the script in  script editor of QV.. are sure it works?

Many rhanks.

K.

Not applicable
Author

Correct:

IF (

        (DayNumberOfYear(posting)) < 7

         and week(posting) > 2

        , 1 ,    

         week(date#( posting, 'DD/MM/YYYY')))  as weekly ,