DAX Logical - IFERROR function


Advertisements

Description

Evaluates an expression and returns a specified value if the expression returns an error. Otherwise, returns the value of the expression itself.

Syntax

IFERROR (<value>, <value_if_error>) 

Parameters

Sr.No. Parameter & Description
1

value

Any value or expression.

2

value_if_error

Any value or expression.

Return Value

  • The value returned by the expression, if error is not returned.

  • The alternative value provided, if error is returned.

Remarks

You can use the function IFERROR to trap the errors returned by expressions and have meaningful values returned without abruptly stopping the evaluation.

  • Both value and value_if_error must be of the same data type. Hence, the column or expression used for value and the value returned for value_if_error must be of the same data type.

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

Example

= IFERROR (5/0,"Div by zero") returns Div by zero. 
= IFERROR (5/1,"Div by zero") returns 5. 
dax_functions_logical.htm

Useful Video Courses


Video

Mastering DAX and Data Models in Power BI Desktop

53 Lectures 5.5 hours

Abhay Gadiya

Video

Mastering DAX Studio

Featured

24 Lectures 2 hours

Randy Minder

Video

DAX / Power BI - Customer and Sales Analysis Deep Dive

26 Lectures 4.5 hours

Randy Minder

Advertisements