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: 
kkkumar82
Specialist III
Specialist III

Week Numbers for dates

HI all,

Consider I have this following code in the edit script.

Let vDay = Num(today());

LOAD

RowNo() as Sno,

Date($(vDay) -RowNo() +1 ) as Day,

num(Rand() * 1000, ' #,##0.00' ) as Amount

AutoGenerate 365;

What I want in this code is a week number for each date based on month and year

Like for example

Sno,Day,Amount, WeeknoMonthly, weeknumberyearly

125,24-03-2016, 205, 4,14

Hope I am clear.

Thanks

Kiran Kumar

10 Replies
sunny_talwar

I think for WeekNumberYearly you can try the Week() function. Not really sure what you can do for WeekNoMonthly

swuehl
MVP
MVP

For week number monthly, try something like

Autonumber( Week(Day), MonthName(Day) )

kkkumar82
Specialist III
Specialist III
Author

Hi sunny,

=Week(Date#('06-01-2016','DD-MM-YYYY')) is giving 1 , just curious to know

when I use first day of this year, 01-01-2016 my system is giving 53. can you elaborate on this.

Thanks

Kiran Kumar

sunny_talwar

Check this link out:

BrokenWeeks ‒ QlikView

UPDATE: Set BrokenWeeks=1;

This will make Jan 1st as Week 1

swuehl
MVP
MVP

Or for older versions

Redefining the Week Numbers

QlikView by default is using ISO week numbering, as mentioned in Henric's blog post.

kkkumar82
Specialist III
Specialist III
Author

Sunny,

I tried with the following after setting the BrokenWeeks to 1 ,

=Week(Date#('01-01-2016','DD-MM-YYYY'))

but still getting 53.

thanks

kiran

swuehl
MVP
MVP

I think you need also

Set ReferenceDay=1;

MarcoWedel

Hi,

maybe helpful:

Week creation

regards

Marco

kkkumar82
Specialist III
Specialist III
Author

Thanks all for your advises will come back shortly