Home » DAX » DAX – IFERROR Function

DAX – IFERROR Function

IFERROR DAX Function

Evaluates an expression and returns a specified value if the expression encounters an error; otherwise, it returns the value of the expression itself.



Syntax:

IFERROR ( <Value>, <Value_If_Error> )

Description:

S no. Parameter Description
1 Value Any value or expression.
2 Value_If_Error Any value or expression, give error message here.

Let’s get started-

Following these steps-

Step-1: Create a measure and write below expression in measure, here we creating an error situation to adding String and Number value.

Generate_Error = "A"+1
Measure in Power Bi

Measure in Power BI

Step-2: Now, add a Card visual to your Power BI page and drag the measure onto it.

Conversion Error in Measure

Conversion Error in Measure

As you saw, it returns an error ‘can not convert Text to Number’, now we handle the error with some messages.





Step-3: Create other measure and write below expression in measure.

IFERROR_Measure = IFERROR("A"+1,"Wrong Input")
IFERROR-DAX

IFERROR – DAX

Step-4: After this drag measure into Card visual, it returns the given error message instead of conversion error.

IFERROR DAX Example

IFERROR DAX Example

If expression not return any error, it returns the value of expression, Let’s take a closer look.

IFERROR_Measure_2 = IFERROR(1+1,"Wrong Input")
IFERROR - DAX

IFERROR – DAX

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.




Recommended Power BI Post:

ALLEXCEPT

UNION

DATATABLE

ALLSELECTED

ALL

ADDCOLUMNS

Leave a Reply