Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
jmonroe918
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
swuehl
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
swuehl
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

its_anandrjs

you have to write two script and concat them try like

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

its_anandrjs

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]

jmonroe918
Creator II
Creator II
Author

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

swuehl
MVP
MVP

Use the num() function to format with two digits

num(week(Datefield),'00')

its_anandrjs

For week no with '00' use it like

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