Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

1 Solution

Accepted Solutions
sunny_talwar

Have you tried this:

Week(DateField)

View solution in original post

5 Replies
sunny_talwar

Have you tried this:

Week(DateField)

sunny_talwar

Or this:

Week(Date#(DateField, 'DD-MM-YYYY'))

qlikviewwizard
Master II
Master II

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

];

sasiparupudi1
Master III
Master III

=Week(Date#('04-01-2015','DD-MM-YYYY'))

Anonymous
Not applicable
Author

Thanks all of you, actually all the things worked.