Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
lalitkgehlot89
Creator II
Creator II

Need logic help to write nested if condition.

Hi,

In Attached data need logic help to write the nested if condition.

I need only the rows with below mention condition.

1) [Location Code]=209931 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],4)='VEND' and [Quantity]>0  as Purchase

    [Location Code]=209931 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],4)='VEND' and [Quantity]<0 as PurchaseReturn

2) Location Code :- GC/SR/016 and [Entry Type]=4 and [ReceiptFROM]=209910,RECD-M,DTG-SYMP,SYMP,HARMONY-M,MFG-EMB,209920,209932,GC/WH/50,209915 and [Quantity]>0 as Purchase

    Location Code :- GC/SR/016 and [Entry Type]=4 and [ReceiptFROM]=209910,RECD-M,DTG-SYMP,SYMP,HARMONY-M,MFG-EMB,209920,209932,GC/WH/50,209915 and [Quantity]<0 as PurchaseReturn

3) Location Code :- 209910 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],2)<>'IN' and [Quantity]>0  as Purchase

    Location Code :- 209910 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],2)<>'IN' and [Quantity]<0  as PurchaseReturn


    Location Code :- 209910 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],2)='IN' and [Quantity]>0  as INWARD


    Location Code :- 209910 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],2)<'IN' and [Quantity]<0  as OUTWARD

3 Replies
adamdavi3s
Master
Master

Personally I would add these as columns in the load script rather than trying to do it in the front end..

but either way just do if() + if() + if()

so:

If([Location Code]=209931 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],4)='VEND' and [Quantity]>0, sum(yourfield),0)

+

if([Location Code]='GC/SR/016' and [Entry Type]=4 and [ReceiptFROM]=209910,RECD-M,DTG-SYMP,SYMP,HARMONY-M,MFG-EMB,209920,209932,GC/WH/50,209915 and [Quantity]>0, sum(yourfield),0)

+

if([Location Code]=209910 and [Entry Type]=0 and left([Gen_ Bus_ Posting Group],2)<>'IN' and [Quantity]>0, sum(yourfield),0)  as Purchase

lalitkgehlot89
Creator II
Creator II
Author

Hi Adam,

I want to create the field on backend.

adamdavi3s
Master
Master

yep so just write that as a preceeding load in your script