Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Zurich on Sept 24th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
bazzaonline
Creator
Creator

WeekNum Function Help?

Hello,

Im trying to create something in the script that translates a yyyy-mm-dd day format to give me a weeknum, ideally year then number.  So yyyy-01, yyyy-02 etc etc..

Thanks Paul

1 Solution

Accepted Solutions
fvelascog72
Partner - Specialist
Partner - Specialist

Hi, Try this:

Year(Date)&'-'&Week(Date)

View solution in original post

6 Replies
fvelascog72
Partner - Specialist
Partner - Specialist

Hi, Try this:

Year(Date)&'-'&Week(Date)

swuehl
MVP
MVP

Weekyear(date#(YourField,'YYYY-MM-DD'))&-&Week(date#(YourField,'YYYY-MM-DD'))

alexandros17
Partner - Champion III
Partner - Champion III

Try with WeekYear(myDate) & '-' & Num(Week(myDate),'00')

let me know

Anonymous
Not applicable

Hi ..

This a example:

=Year(date('2015-06-01','YYYY-MM-DD'))&'-'&Week(date('2015-06-01','YYYY-MM-DD'))

output

2015-23

=Year(date(fieldDate,'YYYY-MM-DD'))&'-'&Week(date(fiedDate,'YYYY-MM-DD'))

bazzaonline
Creator
Creator
Author

Brilliant, saved me a world of hassle!

alexandros17
Partner - Champion III
Partner - Champion III

Take a look at my answer:

WeekYear takes the year in wich the week follows so it is the correct year because for some dates you could have wrong year week combinations.

Second I put Num(...) formatted with two digits '00' in this way your output will Always have the same lenght, otherways you will have

20151

20152

201511

and so on