Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

if else

HI All,

i have two conditions written i.e.

if(Country='Brazil' and Strategic_Part='Tubes',    

if(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.055),

if(Strategic_Part<>'Tubes' and not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.200,

if(IsNull([U-D_NL9s]) or [U-D_NL9s]=0 or [U-D_NL9s]=0.01, [mat con loc cur]*1*-1))) ,

if (Match(Country,'Russia','Russian Federation','Indonesia') and Strategic_Part='Tubes',

if(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.055),

if(Strategic_Part<>'Tubes' and not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.270,

if(IsNull([U-D_NL9s]) or [U-D_NL9s]=0 or [U-D_NL9s]=0.01, [mat con loc cur]*1*-1))) as T1

My first condition(else part not happening) is not working the formula where i have renamed T1 only it is considering ..


Can you please help me where i have missed out.

Thanks,

Bharat

22 Replies
sunny_talwar

but what is not working Bharat? I don't really know what part of the expression is the problem... that is what I am hoping you can help me find. or share some data which we can run with this and you can tell us what the expected output needs to be based on the data provided...

bharatkishore
Creator III
Creator III
Author

Sunny bhai attached app as well.

Please see the select fields there we will see the condition

sunny_talwar

Can you also share Consfiltered_NR.qvd and also point out what the issue is?

bharatkishore
Creator III
Creator III
Author

PFA qvd sunny bhai.. and also please find the below image

T.PNG

Here if you see i can see the if condition but it should be in T1 ..May be because am i missing an brace..

Sorry sunny bhai to not ask you correctly

shansundar
Partner - Creator
Partner - Creator

Hi Bharat,

I don't see any comparison for your first condition and second condition, so Qlik will consider it as two columns ideally one column without any name and the second column as T1 and thats the reason your T1 is always showing only the second condition.

Add some comparison to tell Qlik when to consider Condition 1 and when to consider condition 2.ifelse.png

bharatkishore
Creator III
Creator III
Author

I am trying to achieve that one only,

the  below one is the first condition:

if(Country='Brazil' and Strategic_Part='Tubes',

if(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.055),

if(Strategic_Part<>'Tubes' and not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.200,

if(IsNull([U-D_NL9s]) or [U-D_NL9s]=0 or [U-D_NL9s]=0.01, [mat con loc cur]*1*-1)))


if this is not satisfied then it should go to next condition i.e. the below one


if (Match(Country,'Russia','Russian Federation','Indonesia') and Strategic_Part='Tubes',

if(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.055),

if(Strategic_Part<>'Tubes' and not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.270,

if(IsNull([U-D_NL9s]) or [U-D_NL9s]=0 or [U-D_NL9s]=0.01, [mat con loc cur]*1*-1))) as T1


But it is not considering the first one.. can you please help me how  to achieve it


sunny_talwar

What is T1?... you don't have to apologize for anything.... but I am not sure what exactly are you trying to do here? Can you put your required condition in plan simple words

If country is Brazil and stratgtic_part is Tubes and..... then do this

If .... then

If ... then

etc

sunny_talwar

Try this

    If(Country='Brazil',

  If(Strategic_Part='Tubes',     

If(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.055, [mat con loc cur]*1*-1),

If(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.200, [mat con loc cur]*1*-1)),

If(Match(Country,'Russia','Russian Federation','Indonesia'),

If(Strategic_Part='Tubes',

If(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.055, [mat con loc cur]*1*-1),

If(not IsNull([U-D_NL9s]) and [U-D_NL9s]<>0 and [U-D_NL9s]<>0.01, mat_con_qua*-1*[U-D_NL9s]*1.270, [mat con loc cur]*1*-1)))) as test

bharatkishore
Creator III
Creator III
Author

T1 is the name i have given..

if country = brazil ,and strategic_part is Tubes and and stratgtic_part is Tubes and [U-D_NL9s] not null  and [U-D_NL9s] <>0 and [U-D_NL9s] <> 0.01 then [Quantity]*(-1)*[price nl9s U-D]*1.055 


else (same condition but only change is strategic_part <> Tubes) , then


if country = brazil ,and strategic_part is Tubes and and stratgtic_part is Tubes and [U-D_NL9s] not null  and [U-D_NL9s] <>0 and [U-D_NL9s] <> 0.01 then [Quantity]*(-1)*[price nl9s U-D]*1.200


else

if country =('Russia','Indonesia') ,and strategic_part is Tubes and and strategic_part is Tubes and [U-D_NL9s] not null  and [U-D_NL9s] <>0 and [U-D_NL9s] <> 0.01 then [Quantity]*(-1)*[price nl9s U-D]*1.055

else (same condition but only change is strategic_part <> Tubes) , then


if country =('Russia','Indonesia') ,and strategic_part is Tubes and and strategic_part <> Tubes and [U-D_NL9s] not null  and [U-D_NL9s] <>0 and [U-D_NL9s] <> 0.01 then [Quantity]*(-1)*[price nl9s U-D]*1.055


as Test..


Like this sunny bhai



bharatkishore
Creator III
Creator III
Author

Thank you Sunny bhai.. one last line i have to add at the end of the formula i.e.

if(IsNull([U-D_NL9s]) or [U-D_NL9s]=0 or [U-D_NL9s]=0.01, [mat con loc cur]*1*-1

if i am adding i am getting error(missing brace) can you tell me where i have to add..