Like most languages, you will probably run into the divide by zero issue at some point with DAX. I checked around and saw some different solutions people are using. The best example I found was this pattern by Kasper de Jonge.
IF([Measure 2] <> 0, [Measure 1] / [Measure 2], 0)
.
I also looked at the DIVIDE() function for DAX on MSDN. It has the following syntax:
DIVIDE(numerator, denominator [,alternateresult])
Much less code than before!
I ran a very informal test with 1M rows to compare the two. There doesn’t appear to be any difference in performance based on my test, however I should do it again using more data. I checked into it a little more and noticed that both appear to throw the same errors. For instance, when the numerator or denominator is text both methods result in an error.
Has anyone else come across this? There is not too much information out there about error checking in DAX.