Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

everest226
Contributor III

breaking number to year and week

i have a field    [QVDYEARWEEK] which has value in number    which has year and week attach , how to break this into year and week

LOAD TABLE1

[Good Type],

     [Good Description],

    QVDYEARWEEK

from

---------------

Tags (1)
1 Solution

Accepted Solutions
jwjackso
Contributor III

Re: breaking number to year and week

I don't know if TABLE1 is a field name or the table you are loading, so assuming it is the table name, try using a preload statement:

TABLE1:

Load *,

         Mid(QVDYEARWEEK,1,4) as YR,

         Mid(QVDYEARWEEK,5,2) as WK;

LOAD

[Good Type],

     [Good Description],

    QVDYEARWEEK

2 Replies
jwjackso
Contributor III

Re: breaking number to year and week

I don't know if TABLE1 is a field name or the table you are loading, so assuming it is the table name, try using a preload statement:

TABLE1:

Load *,

         Mid(QVDYEARWEEK,1,4) as YR,

         Mid(QVDYEARWEEK,5,2) as WK;

LOAD

[Good Type],

     [Good Description],

    QVDYEARWEEK

Digvijay_Singh
Honored Contributor III

Re: breaking number to year and week

or directly in the same load like this -

LOAD TABLE1

[Good Type],

     [Good Description],

    Num(Left(QVDYEARWEEK,4)) as Year,

     Num(Right(QVDYEARWEEK,2)) as Weekno

Community Browser