Math Formula with condition or column expression

Hello Community,
how we can use either of Math formula or column expression to do the following

if Var1 > 0 and Var2 >0 and Var3 = 0 then (Var1 +Var 2)/(T1+T2)
else if
Var1 > 0 and Var2 =0 and Var3 > 0 then (Var1 +Var 3)/(T1+T3)

Hello @mh_elhassan

The following workflow shows how to implement an ā€œif-then-elseā€ condition using the -Math Formula- node:

The ā€œif-then-elseā€ conditions can be nested in the -Math Formula- node as required in your example.

Hope this helps.

Best
Ael

4 Likes

Hey @aworker thanks for your reply
Should then put all columns before the if .
in my question above each var and t represents a column so i need to check if in each column the value is above 0 then sum and divide accordingly

Hello @mh_elhassan,

although you can do if else logic with Math Formula node I suggest to use Column Expressions node. Take a look here:

Br,
Ivan

2 Likes

Thanks a lot @ipazin
it takes a little bit to get used to it, but it is finally working. the syntax is different from the usual
again thanks

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.