Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script Assistance on adding a field

In my script, I redefined a field as follows in order to differentiate this date field from others in the dashboard :

Date as 'CC_Date'    

Now I want to create a week field based on the 'CC_Date'. However, when I use:

Week(CC_Date) as Week,

The script is coming back as invalid because of my field for week.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can't reference your new field CC_Date in the same LOAD statement where you are creating it.

You can use the new field in a preceding LOAD

Preceding Load

or reference the original field name:

LOAD *,

     Week(CC_Date) as WeekOnNewField;

LOAD

     Date as 'CC_Date' ,

     Week(Date) as WeekOnOriginalField,

     ...

FROM ...;

Your Date field should show a numeric representation in both cases, to allow the Week() function to work.

Get the Dates Right

View solution in original post

1 Reply
swuehl
MVP
MVP

You can't reference your new field CC_Date in the same LOAD statement where you are creating it.

You can use the new field in a preceding LOAD

Preceding Load

or reference the original field name:

LOAD *,

     Week(CC_Date) as WeekOnNewField;

LOAD

     Date as 'CC_Date' ,

     Week(Date) as WeekOnOriginalField,

     ...

FROM ...;

Your Date field should show a numeric representation in both cases, to allow the Week() function to work.

Get the Dates Right