
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Convert date to weeknumber
Hi all,
How can I convert a date to a weeknumber if the date format is DD-MM-YYYY?
I have tried to search in the forum but have not been able to find the right answer.
Thanks
Peter
- Tags:
- new_to_qlikview
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried this:
Week(DateField)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or this:
Week(Date#(DateField, 'DD-MM-YYYY'))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Please use the example.
SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='$#,##0.00;($#,##0.00)';
SET TimeFormat='h:mm:ss TT';
SET DateFormat='DD-MMM-YYYY';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
EMP:
LOAD *, num(WeekDay(date(DATE))) as Week_Number;
LOAD EMPNO,ENAME,JOB,date(DATE) as DATE,Ceil(month(date(DATE))/3) as Quarter,SAL,Alt(SAL,'NULL'&RecNo()) as SAL1 Inline [
EMPNO,ENAME,JOB,DATE,SAL
7369,SMITH,CLERK,1-Jan-15,
7369,SMITH,CLERK,1-Apr-15,
7499,ALLEN,SALMAN,1-Jan-15,4000
7499,ALLEN,SALMAN,1-Apr-15,5000
7521,WARD,SALMAN,1-Jan-15,6000
7521,WARD,SALMAN,1-Apr-15,1500
7566,JONES,MANAGER,1-Jan-15,2500
7566,JONES,MANAGER,1-Apr-15,1100
7654,MARTIN,SALMAN,1-Jan-15,
7654,MARTIN,SALMAN,1-Apr-15,
7698,BLAKE,MANAGER,1-Jan-15,3450
7698,BLAKE,MANAGER,1-Apr-15,4000
7782,CLARK,MANAGER,1-Jan-15,4000
7782,CLARK,MANAGER,1-Apr-15,5000
7788,SCOTT,ANALYST,1-Jan-15,6000
7788,SCOTT,ANALYST,1-Apr-15,1500
7839,KING,PRESIDENT,1-Jan-15,3600
7839,KING,PRESIDENT,1-Apr-15,3450
7844,TURNER,SALMAN,1-Jan-15,1250
7844,TURNER,SALMAN,1-Apr-15,4000
7876,ADAMS,CLERK,1-Jan-15,5000
7876,ADAMS,CLERK,1-Apr-15,6000
7900,JAMES,CLERK,1-Jan-15,3450
7900,JAMES,CLERK,1-Apr-15,4000
7902,FORD,ANALYST,1-Jan-15,4000
7902,FORD,ANALYST,1-Apr-15,5000
7934,MILLER,CLERK,1-Jan-15,6000
7934,MILLER,CLERK,1-Apr-15,6000
];


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
=Week(Date#('04-01-2015','DD-MM-YYYY'))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks all of you, actually all the things worked.
