This might be a good reference for this topic: https://www.jmp.com/support/help/en/16.2/#page/jmp/use-local-variables-in-formulas.shtml