Kibana Formula using ifelse with multiple conditions

How can I combine multiple conditions in an ifelse statement? I need to avoid a situation where I divide by zero e.g. any of the following values: count() and count(shift='1w')+count(shift='2w') may not be 0 to avoid a N/A value which causes the wrong Dynamic coloring to be applied to it...

I am calculating the deviation of my current transactions with historic values: count()-((count(shift='1w')+count(shift='2w'))/2). Negative percentages show a decrease, positive an increase...

Hello,

For deviation can we try using derivatives ?

Alas - not an option for me: I am working in Lens and am limited to the formulas available to me there (using 8.6.2 at present)