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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Sunil_Kenth
Former Employee
Former Employee

Help with IF statement and adding additional columns in script

Hi,

I would like some help with IF syntax.

I am trying to add an additonal column called 'T2' in my table through the load script, this is what i have so far:

IF

      (

      Tier2_Org_Area = 'Europe & Digital' OR

      Tier2_Org_Area = 'USA', 'RED') as T2,

IF

      (

       Tier2_Org_Area = 'Africa', 'Blue')

  as T2

However when i reload the data i get an error message saying column names cannot be the same, I was hoping the second IF statement would just be concatenated to the first T2 column?

Any ideas?

Thanks

Sunil

Labels (1)
1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi Sunil,

I'm not sure with this help you or not

IF(Tier2_Org_Area = 'Europe & Digital' OR Tier2_Org_Area = 'USA', 'RED',

    IF(Tier2_Org_Area = 'Africa', 'Blue','Other')) as T2,

Let me know.

Regards,

Sokkorn

View solution in original post

3 Replies
its_anandrjs
Champion III
Champion III

Hi,

You have to write some thing like

IF(

  Tier2_Org_Area = 'Europe & Digital' OR

  Tier2_Org_Area = 'USA', 'RED',

IF(

  Tier2_Org_Area = 'Africa', 'Blue') )

  as T2

Rgds

Anand

Sokkorn
Master
Master

Hi Sunil,

I'm not sure with this help you or not

IF(Tier2_Org_Area = 'Europe & Digital' OR Tier2_Org_Area = 'USA', 'RED',

    IF(Tier2_Org_Area = 'Africa', 'Blue','Other')) as T2,

Let me know.

Regards,

Sokkorn

its_anandrjs
Champion III
Champion III

Hi,

You have to write some thing like see in example

Data:

Load * inline

[

Tier2_Org_Area

Europe & Digital

USA

Africa

];

Load

*,

IF(

  Tier2_Org_Area = 'Europe & Digital' OR

  Tier2_Org_Area = 'USA', 'RED',

IF(

  Tier2_Org_Area = 'Africa', 'Blue'))

  as T2

Resident Data;

See the example file

Rgds

Anand