Knowledge Base
Open App
KB 101000

Function replace IFERROR/DIVIDE

The IFERROR function can be replaced by DIVIDE.


The IFERROR function catches any error, including conversion errors. When the expression is a division operator, the error that is more likely to happen is a division by zero. The DIVIDE function specifically manages the division by zero condition without intercepting any other error, resulting in faster execution time.


You can Ignore the issue if the model is in DirectQuery mode.

This optimization can be counterproductive in DirectQuery models. The IFERROR function is usually folded into a query to the underlying database, whereas the DIVIDE function is not. Therefore, this optimization should be used only when the model is in Import mode.


Replace the IFERROR function with DIVIDE, moving the denominator expression in the second argument of DIVIDE. The second argument of IFERROR becomes the third argument of DIVIDE.

Original code

    [Amount] / [Quantity], 

Possible optimization