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: 
markgraham123
Specialist
Specialist

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.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

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;

View solution in original post

3 Replies
maxgro
MVP
MVP

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
Specialist
Specialist
Author

Hi Massino,

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

markgraham123
Specialist
Specialist
Author

I got u.

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

Thank you Massimo.