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: 
Not applicable

Case statement in Load script

Hi,

i'm new to qlikview, can we write a case statement in Load script  as we do in the sql select statement? when i try to write the below script its giving me syntax error, can someone please help me in solving this.

CASE WHEN (Product ='Toys')

THEN ([Revenue]+[Tax]+[GP]) ELSE

([Revenue]) END TotalRevenue

1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Try

LOAD

     IF( Product = 'Toys', [Revenue]+[Tax]+[GP], [Revenue]) as TotalPrice,

     ...

FROM ...;

View solution in original post

4 Replies
swuehl
Champion III
Champion III

Try

LOAD

     IF( Product = 'Toys', [Revenue]+[Tax]+[GP], [Revenue]) as TotalPrice,

     ...

FROM ...;

maxgro
MVP
MVP

load

     .....,

     if(Product ='Toys'

          [Revenue]+[Tax]+[GP],

          [Revenue]

     ) as TotalRevenue,

     ......

from

     ......

mark_casselman
Creator
Creator

Hi,

The CASE statement is not available in QV. Just use IF statement:

IF (Product='Toys',[Revenue]+[Tax]+[GP],[Revenue]) as TotalRevenue

Mark

A_C
Contributor
Contributor

Hi Swuehl,

I have a case statement in my SQL select query within qliksense. I keep getting an error when running my load. I am finding that maybe case statements do not work inside Qlik data load editor. How would I write this case statement? Any help would be greatly appreciated!

CASE
SUI.ITEM_TYPE ='B'
THEN SUI.BOM_NET_COST
ELSE SUI.NET_COST
END AS NET_COST

This is what I have but I continue to receive the error message:

IF (SUI.ITEM_TYPE = 'B',
[SUI.BOM_NET_COST],
[SUI.NET_COST])
AS NET_COST