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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
hykal1993
Contributor II
Contributor II

How Do I create new variable based on a formulated variable in load editor (Qlikview)

Hi,

When I generated below it doesn't work. How do I use back the variable I just set, thanks.

LOAD

     [Open Date],

     If(year([Open Date])=year(now()) and month([Open Date])=month(now())-1, 'Yes','No') as [V1-5],

     If([V1-5] = 'No', 'Exclude', 'Include') as [Exclude?]

1 Solution

Accepted Solutions
shwethaa
Contributor III
Contributor III

LOAD

     *,

     If([V1-5] = 'No', 'Exclude', 'Include') as [Exclude?]

     ;

This statement must be above previous load statement. And from is not required.  As gysbert mentioned.

View solution in original post

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

With a preceding load. The new field [V1-5] has to exist before you can use it.

LOAD

     *,

     If([V1-5] = 'No', 'Exclude', 'Include') as [Exclude?]

     ;

LOAD

     [Open Date],

     If(year([Open Date])=year(now()) and month([Open Date])=month(now())-1, 'Yes','No') as [V1-5],

     .... other fields

FROM

     ...somewhere


talk is cheap, supply exceeds demand
hykal1993
Contributor II
Contributor II
Author

Do you mean define [V1-5] first because what you wrote above is the other way around.

Also, when I load again, do I need to load the data again and after FROM do I need to point back to the data source

shwethaa
Contributor III
Contributor III

Refer Preceding Load for preceding load.

In Preceding Load below code will be executed first

LOAD

     [Open Date],

     If(year([Open Date])=year(now()) and month([Open Date])=month(now())-1, 'Yes','No') as [V1-5],

     .... other fields

FROM

     ...somewhere

then

LOAD

     *,

     If([V1-5] = 'No', 'Exclude', 'Include') as [Exclude?]

     ;

It takes input from previous load.

hykal1993
Contributor II
Contributor II
Author

LOAD

     [Open Date],

     If(year([Open Date])=year(now()) and month([Open Date])=month(now())-1, 'Yes','No') as [V1-5],

     .... other fields

FROM

     [source path]

then

LOAD

     *,

     If([V1-5] = 'No', 'Exclude', 'Include') as [Exclude?]

     ;

FROM

    [ What should I write here??]

shwethaa
Contributor III
Contributor III

LOAD

     *,

     If([V1-5] = 'No', 'Exclude', 'Include') as [Exclude?]

     ;

This statement must be above previous load statement. And from is not required.  As gysbert mentioned.