Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Week Day Number


I am trying to load date data where my field 'createdate' will display "Year/Wk" (Example: April 15, 2014 would display '2014/16", the year and the week number).

In my script I have:

Date(WeekStart([createdate]), 'YYYY/WW') as [Yr/Week Opened]

However the date is displaying as "2014/00" on all records. How do I get the week number to display?

Thanks.

Jeff

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

The format codes 'WW' is for weekday (so 00 since you are calling for weekstart)

  • "WW" will return the number with two digits (e.g. 02 for Wednesday).

Use

     year([createdate]) & '/' & week([createdate]) as [Yr/Week Opened]

View solution in original post

6 Replies
Highlighted
MVP
MVP

The format codes 'WW' is for weekday (so 00 since you are calling for weekstart)

  • "WW" will return the number with two digits (e.g. 02 for Wednesday).

Use

     year([createdate]) & '/' & week([createdate]) as [Yr/Week Opened]

View solution in original post

Highlighted

you have to write two script and concat them try like

= Year(today())&'/'& Week(Today())

Highlighted

For this script

Date(WeekStart([createdate]), 'YYYY/WW') as [Yr/Week Opened]


here 'YYYY/WW' is not working because it is a date format but you use 'WW' as week so for your script try like


Year( [createdate], 'YYYY') &' / '& Week ([createdate])   as [Yr/Week Opened]


or   


Year( [createdate] ) &' / '& Week ([createdate])   as [Yr/Week Opened]

Highlighted
Creator II
Creator II

Thanks swuehl.

Is ther any way to force the week number to display two digits? Like 01, 02, 03....?

It helps with the sort otherwise I get 1, 10, 11...2, 21, 22, 23...3, 31...etc.

Thanks.

Jeff

Highlighted
MVP
MVP

Use the num() function to format with two digits

num(week(Datefield),'00')

Highlighted

For week no with '00' use it like

Year( [createdate] ) &' / '&  Num( Week ([createdate]) ,'00')  as [Yr/Week Opened]