When performing a ratio calculation, if your data has any situation where there would be a zero in the denominator, the code will produce an error when executed. The fix for this is to use the NULLIF function in any denominator that could be zero when evaluated with actual data.

For example, the following code:

[numerator] / [denominator]

can safely be replaced with:

[numerator] / NULLIF([denominator], 0)

This will return a NULL value into the resulting dataset for cases where the denominator value was in fact 0, and otherwise will give the expected ratio result. More on the NULLIF function can be found here: https://support.lityxiq.com/722718-Conditional-and-Null-Handling-Functions.