IFERROR

Updated on

IFERROR is a DAX function that returns a specified value if the first expression results in an error, otherwise it returns the value of the first expression.

Syntax

IFERROR(
   Value,
   ValueIfError
)
Argument Properties Description
Value Any value or expression.
ValueIfError Any value or expression.

Return Values

A scalar of the same type as value

Remarks

  • You can use the IFERROR function to trap and handle errors in an expression.

  • If value or value_if_error is an empty cell, IFERROR treats it as an empty string value (“”).

  • The IFERROR function is based on the IF function, and uses the same error messages, but has fewer arguments. The relationship between the IFERROR function and the IF function as follows:

    IFERROR(A,B) := IF(ISERROR(A), B, A)

    Values that are returned for A and B must be of the same data type; therefore, the column or expression used for value and the value returned for value_if_error must be the same data type.

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

  • For best practices when using IFERROR, see Appropriate use of error functions.

Example

The following example returns 9999 if the expression 25/0 evaluates to an error. If the expression returns a value other than error, that value is passed to the invoking expression.

= IFERROR(25/0,9999)

Other functions related to IFERROR are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/iferror-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy