Hi Mirza,
Well if it such intensive logic, i would recommend you re-think of the approach to persist the values while bringing the data in itself in the table.
Perhaps a rule written via SLT or any other tool which you're using thereby making even the redundant computation faster while modeling.
Calculated column is the way to go if it's a graphical based. If you're able to identify the combination, you can rely on the various functions in the calculated column and achieve the desired result.