The following expression works perfectly:
However if I insert a variable to replace the 4 as follows I get zero
I have tested the value in the variable and it is 4 so this should work.
The expression editor says the syntax is correct.
The variable is declared as