IFERROR()

Learn why IFERROR only catches a genuine DAX error, substituting a fallback -- and why it leaves a BLANK() result completely untouched, since blank is a valid value, not an error.

IFERROR()

IFERROR() catches a genuine DAX error and substitutes a fallback value. It does not catch, replace, or otherwise notice a BLANK() result — blank is a valid value, not an error.

IFERROR(value, value_if_error)

Catching a Real Error

Code Number =
IFERROR(VALUE(Product[Code]), BLANK())

VALUE("A-17") can't convert text to a number, which is a genuine DAX error: in a calculated column it fails the whole column, and in a measure it breaks the visual. Wrapped in IFERROR(), the error is caught and the fallback is returned instead.

(Dividing by zero is not an error in DAX: 10 / 0 returns Infinity, so IFERROR() doesn't catch it. Use DIVIDE() for that.)

Try it live

Scenario

Raw expression, no IFERROR

VALUE("A-17")

Error: cannot convert value 'A-17' of type Text to type Number

Wrapped in IFERROR

IFERROR(VALUE("A-17"), "N/A")

"N/A"

— IFERROR caught the real error and substituted the fallback "N/A".


Not Catching a Blank

IFERROR(SUM(Sales[Amount]), "N/A")

If the current filter context has zero matching rows, SUM() returns BLANK() — not an error. IFERROR() only intercepts genuine errors, so this passes the BLANK() straight through unchanged; the "N/A" fallback is never used, even though the result looks just as "empty" to a viewer as an error would.

VALUE("A-17")                              -> Error: can't convert to a number
IFERROR(VALUE("A-17"), BLANK())            -> BLANK          (caught)
[Total Sales] / 0                          -> Infinity       (not an error, so not caught)

SUM(Sales[Amount])   with 0 matching rows  -> BLANK()
IFERROR(SUM(Sales[Amount]), "N/A")         -> BLANK()        (not caught -- blank isn't an error)

Common Mistakes

Expecting IFERROR to Also Convert Blanks to a Fallback

IFERROR(measure, 0) does not turn a blank result into 0 — only an actual error becomes 0 this way; a blank result stays blank. Converting blank to a specific fallback value needs an explicit check instead, such as IF(ISBLANK(measure), 0, measure), or DAX's COALESCE() function (which returns the first non-blank value in a list, built specifically for this).

Wrapping DIVIDE() in IFERROR

IFERROR(DIVIDE([Total Profit], [Total Sales]), 0)

DIVIDE() already returns BLANK() (or an explicit alternate result, if supplied as its third argument) instead of erroring on division by zero — it never produces the kind of error IFERROR() exists to catch. Wrapping it in IFERROR() adds nothing but extra evaluation cost; see DIVIDE() for the same redundant pattern already covered there.

Using IFERROR to Mask a Genuine Formula Bug

Catching every error with a generic fallback can hide a real modeling or formula mistake that's worth actually seeing and fixing, rather than silently papering over it with "N/A" everywhere.


Best Practices

  • Reach for IFERROR() specifically for expressions that can genuinely error (a text-to-number conversion, a type-mismatch-prone calculation) — not as a catch-all for anything that might look empty.
  • Use DIVIDE() instead of / to avoid Infinity and NaN results; IFERROR() can't catch those, because they aren't errors.
  • Use ISBLANK() or COALESCE() when the actual goal is converting a blank result to a specific fallback — IFERROR() doesn't do this.

Next Steps