Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Week extract from date field ?

Hi

Please find attached the excel file.

I have DATE field. I need to create PERIOD and WEEK (52 weeks) dimensions. Can someone tell me the logic?

Many thanks

4 Replies
Not applicable

Week extract from date field ?

Can anyone help me please ?

Many thanks

Not applicable

Week extract from date field ?

Hi,

I think you'd be best creating a basic calendar in your QV document.  If you check the QlikView example docs loaded I think there is one there already, if not I'll dig out an example from here.

You basically build a calendar from a min to max date, for each date in that you define a week number:

WEEK(date) as WEEK

Then I would suggest an inline load (something like the below).  Alternatively do the inline load before as a mapping load an map the period field into the calendar as you build it.

LOAD * INLINE [

    WEEK, PERIOD

    1, P1

    2, P1

    3, P1

    4, P1

    5, P2

    6, P2

    7, P2

    8, P2

    9, P3

];

I hope that helps.

Cheers,

Emma

Not applicable

Re: Week extract from date field ?

Hi Emma

Thanks for your reply.

Can you please elaborate it more.

week(date) as week….. will not work in my case.

Please see the attached file above..For every year, WEEK 1 is starting on First Monday of October.

How to create a dimension for week ?

 

Many thanks

suniljain
Honored Contributor

Re: Week extract from date field ?

Pls check the date format you are passing in week() function.it should be in following format

e.g week( '1971-10-30' ) returns 43.

Community Browser