Home » DAX » DAX – IFERROR Function

DAX – IFERROR Function

IFERROR DAX Function

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> )

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 start with an example:

Create 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

Now take one Card visual into Power Bi page and drag measure over there.

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.




Create other measure and write below expression in measure.

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

IFERROR – DAX

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 see-

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