Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i'm new to Qlikview, Is it possible to write a case statement in the Load script? i'm trying to write the below script and its giving syntax errors. can someone please help me in figuring out this.
CASE WHEN (Product ='Toys')
THEN ([Revenue]+[Tax]+[GP]) ELSE
([Revenue]) END TotalPrice
Try
LOAD
IF( Product = 'Toys', [Revenue]+[Tax]+[GP], [Revenue]) as TotalPrice,
...
FROM ...;
Try
LOAD
IF( Product = 'Toys', [Revenue]+[Tax]+[GP], [Revenue]) as TotalPrice,
...
FROM ...;
if(Product = 'Toys',
[Revenue] + [Tax] + [GP],
[Revenue]
) AS TotalPrice
You can look up the conditional functions in help e.g. if then else. Or Sub...end sub if you need a loop to create fields/tables.
Maybe something like this works for you:
Load
if(Product = 'Toys', [Revenue] + [Tax] + [GP], [Revenue]) as TotalPrice
resident / from...
Hi,
I think the When statement, as well as Case are control structures for altering the behaviour of complete blocks of script (for example full tables).
What you describe can be done either with pick(match()) or if. Pick(match()) can be useful if you have several escenarios like
pick(match(Product, 'Toys','Fruits','Furniture'), Formula1, Formula2, Formula3) as Field
otherwise it would be better with an if
regards
Thanks Everyone!!