Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If condition in load

Hi freiends,

I have a table like

A B C D                    E

1  2 3 sales              Profit

2 3 4  Commisions     Loss

6 8 9  Margin            Profit

Now I have to load based on coumns D and E using resedent load.

If D= sales and e= Profit then A-B as xxxx

else if D=Commission and E = Loss as YYY etc

Thanks

Pavan

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

HI,

Try liek this

LOAD

*,

If (D= 'Sales' and E= 'Profit', A - B,

     If(D='Commissions' and E = 'Loss', somecalculation)) AS XXXX


Regards,

Jagan.

View solution in original post

4 Replies
jagan
Luminary Alumni
Luminary Alumni

HI,

Try liek this

LOAD

*,

If (D= 'Sales' and E= 'Profit', A - B,

     If(D='Commissions' and E = 'Loss', somecalculation)) AS XXXX


Regards,

Jagan.

jyothish8807
Master II
Master II

Hi pavan,

In the script.

Tab1:

Load your normal data from your sheet.

Tab2:

LOAD

*,

If (D= 'Sales' and E= 'Profit', A - B, If(D='Commissions' and E = 'Loss', somecalculation)) AS New Field

resident Tab1;

Regards

KC


Best Regards,
KC
PrashantSangle

Hi

Try like this

LOAD

*,

If (wildmatch(D,'Sales') and wildmatch(E,'Profit'), A - B,

     If(wildmatch(D,'Commissions') and if(E,'Loss'), calculation)) AS NewField

Resident TableName

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sujeetsingh
Master III
Master III

Jagan has given you the way to do so ,

May this in detail will make you clear

Table2:

load *

,If (D= 'Sales' and E= 'Profit', A - B,

     If(D='Commissions' and E = 'Loss', somecalculation)) AS XXXX

resident Table1;

drop table Table1;

Now you can use one more resident load from table 2 if you want to exclude on basis of field XXXXX.