The demo will demonstrate a very common situation: A cross table that includes a custom calculation where a division-by-zero situation can occur.

Labels can be added to the formula to enhance the readability.

- Create a new Analysis with a Cross table showing
**Revenue and Costs per Customer** - Add a new calculation
**Contribution Margin**= (Revenue – Costs) / Revenue * 100. - Apply the global criterion
**Customer Country(Territory) = Asia.**

Notice the “Math errors” – which are caused by division by zero.

To fix this, we will implement an “if-then-else” statement in our calculations syntax.

- In the formula, include an
**if-then-else**statement to handle the division-by-zero issue. Insert “0” when a division by zero is attempted:

## Comments

Demetris GeorgiouI am straggling with the if formula in targit

I have a calculated column that has different values insight however i would like to use the if formula in order to extract any value that is higher from 1o, but when i do so i am also extracting the total of the column. Can somebody clarify why this is taking place?

or provide me with the a formula that will not do that?

Please sign in to leave a comment.