Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

markgraham123
Contributor II

Multiple conditions in If Statement

Hi all,

I'm trying do kind of multiple if statements.

If(SKU='1' and Warehouse='A', Warehouse) as special

But for some reason its not working. May be my syntax problem.

Can some pls look into it.

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Multiple conditions in If Statement

the statement works if you remove the preceding load (bold below)

because in thepreceding load you don't have the special field

//LOAD SKU, Warehouse, Sum(Amount) as SS

//Group By SKU, Warehouse;

LOAD SKU,

    Warehouse,

    Amount,

    If(SKU='1' and Warehouse='A', Warehouse) as special

FROM

C:\Users\ATARIGONDA\Desktop\Book1.xlsx

(ooxml, embedded labels, table is Sheet1);

or this if you want the special field

LOAD

     SKU,

     Warehouse,

     SS,

     If(SKU='1' and Warehouse='A', Warehouse) as special;

LOAD

     SKU, Warehouse, Sum(Amount) as SS

FROM

C:\Users\ATARIGONDA\Desktop\Book1.xlsx

(ooxml, embedded labels, table is Sheet1)

Group By SKU, Warehouse;

3 Replies
MVP
MVP

Re: Multiple conditions in If Statement

the statement works if you remove the preceding load (bold below)

because in thepreceding load you don't have the special field

//LOAD SKU, Warehouse, Sum(Amount) as SS

//Group By SKU, Warehouse;

LOAD SKU,

    Warehouse,

    Amount,

    If(SKU='1' and Warehouse='A', Warehouse) as special

FROM

C:\Users\ATARIGONDA\Desktop\Book1.xlsx

(ooxml, embedded labels, table is Sheet1);

or this if you want the special field

LOAD

     SKU,

     Warehouse,

     SS,

     If(SKU='1' and Warehouse='A', Warehouse) as special;

LOAD

     SKU, Warehouse, Sum(Amount) as SS

FROM

C:\Users\ATARIGONDA\Desktop\Book1.xlsx

(ooxml, embedded labels, table is Sheet1)

Group By SKU, Warehouse;

markgraham123
Contributor II

Re: Multiple conditions in If Statement

Hi Massino,

So, i cannto do If statement along with preceeding load??

markgraham123
Contributor II

Re: Multiple conditions in If Statement

I got u.

I should have included the "Special" field in preceeding load.

Thank you Massimo.

Community Browser