Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
hykal1993
New Contributor

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
Highlighted
shwethaa
New Contributor III

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

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
Highlighted
MVP & Luminary
MVP & Luminary

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

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
Highlighted
hykal1993
New Contributor

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

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

Highlighted
shwethaa
New Contributor III

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

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.

Highlighted
hykal1993
New Contributor

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

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??]

Highlighted
shwethaa
New Contributor III

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

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