Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
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
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
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

you have to write two script and concat them try like

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

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]

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

MVP
MVP

Use the num() function to format with two digits

num(week(Datefield),'00')

For week no with '00' use it like

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