luvv to helpDiscover the Best Free Online Tools
Topic 4 of 8

Handling Blanks And Errors

Learn Handling Blanks And Errors for free with explanations, exercises, and a quick test (for BI Developer).

Published: December 24, 2025 | Updated: December 24, 2025

Why this matters

In BI reports, users see BLANKs and errors as empty cells, missing points, or confusing messages. As a BI Developer, you need to deliberately control when to show 0, when to hide values, and how to avoid divide-by-zero and missing lookup issues. Good blank/error handling leads to trustworthy KPIs and clean visuals.

  • Dashboards: Hide meaningless ratios when a denominator is missing.
  • KPIs: Show 0 only when zero is a real number, not when data is missing.
  • Self-serve: Provide friendly fallbacks (like "All Regions") for slicer labels.

Concept explained simply

In DAX, BLANK is a special value representing "no value." It is not the same as 0 or an empty string. Many aggregations return BLANK when there are no rows in the current filter context.

Mental model

Think of your measure output flowing through the report. At each step, you decide:

  1. If the data is missing, return BLANK() so visuals skip drawing it.
  2. If the data exists but equals zero, return 0 because zero is a valid value.
  3. If a calculation risks an error (division), use a safe function that provides a fallback.

With a few core functions you can control all three.

Blank vs 0 vs empty text
  • BLANK(): "no value". Many visuals hide BLANKs.
  • 0: a real numeric value; visuals will plot it at baseline.
  • "": empty string for text; use sparingly in numeric contexts.

Core patterns for blanks and errors

  • Default a blank to a value:
    COALESCE([Measure], 0)
  • Safe division:
    DIVIDE([Numerator], [Denominator], BLANK())
    The third argument is a fallback when the denominator is 0 or BLANK.
  • Conditional blanking:
    IF(ISBLANK([SomeMeasure]), BLANK(), [SomeMeasure])
  • Single selection with fallback label:
    SELECTEDVALUE(Dim[Label], "All")
  • Early exit with variables:
    VAR d = [Denominator]
    RETURN IF(ISBLANK(d), BLANK(), DIVIDE([Numerator], d, 0))

Worked examples

Example 1 — Profit Margin that never errors

-- Assumes [Total Profit] and [Total Revenue] exist
Profit Margin % = DIVIDE([Total Profit], [Total Revenue], BLANK())

Result: If revenue is BLANK or 0, the result is BLANK (hidden in visuals). Otherwise, a valid percentage is shown.

Example 2 — Default missing amounts to zero

Total Discounts (Safe) = COALESCE(SUM(Sales[DiscountAmount]), 0)

Result: If a category/date has no rows, you see 0 instead of an empty cell. Use this when zero means "none" rather than "unknown."

Example 3 — Friendly label when multiple or no selections

Selected Region Label = SELECTEDVALUE('Region'[RegionName], "All Regions")

Result: Returns the single selected region; otherwise "All Regions." Useful for dynamic titles and cards.

Example 4 — Hide results before the first transaction date

-- [Total Sales] exists; 'Date'[Date] is a proper calendar
Cumulative Sales (Show After First Sale) =
VAR CurrentDate = MAX('Date'[Date])
VAR FirstSaleDate = CALCULATE(
    MIN('Date'[Date]),
    FILTER(ALL('Date'), [Total Sales] > 0)
)
RETURN
IF(
    NOT ISBLANK(FirstSaleDate) && CurrentDate < FirstSaleDate,
    BLANK(),
    CALCULATE([Total Sales], FILTER(ALL('Date'), 'Date'[Date] <= CurrentDate))
)

Result: The cumulative line begins at the first sale instead of starting flat at zero.

Exercises

Mirror these exercises in the editor. Then check your work against the solutions.

Exercise 1 — Profit Margin with precise blank/zero behavior

Create a measure that behaves like this:

  • When [Total Revenue] is BLANK: return BLANK().
  • When [Total Revenue] = 0 (but not BLANK): return 0.
  • Otherwise: [Total Profit] / [Total Revenue].

Call it: Profit Margin % (Strict).

Exercise 2 — Default missing counts and add a context label

Assume you have a measure [Active Customers]. Build two measures:

  1. Active Customers (Safe) that returns 0 when [Active Customers] is BLANK using COALESCE.
  2. Context: Region label that returns the selected region or "All Regions" when no single region is selected.
Checklist before you run
  • Did you use DIVIDE or an IF+DIVIDE pattern to avoid division errors?
  • Did you use COALESCE to convert BLANK to 0 only where zero is semantically correct?
  • Do your labels use SELECTEDVALUE with a sensible fallback?
  • Did you test in a simple table visual by product and date to see blanks vs zeros?

Common mistakes and self-check

  • Using "/" instead of DIVIDE for ratios. Self-check: Change denominator to 0 in a test filter; result should be BLANK or your chosen fallback, not an error.
  • Treating BLANK as 0 everywhere. Self-check: In a matrix, ensure categories with no data are hidden (BLANK), not shown as 0, unless business logic requires zeros.
  • Returning text "N/A" from a numeric measure. Self-check: Keep numeric measures numeric; use separate label measures for text.
  • Forgetting the fallback in SELECTEDVALUE. Self-check: Clear slicers; your card should show a friendly default.

Practical projects

  • Clean KPI pack: Build Revenue, Profit, Profit Margin %, and Cumulative Sales with correct blank handling. Add dynamic titles using SELECTEDVALUE fallbacks.
  • Error-proof ratios: Replace all "/" divisions in a report with DIVIDE and appropriate fallbacks. Document choices (BLANK vs 0) in measure descriptions.
  • Missing lookup handling: If you look up exchange rates or targets, use COALESCE to provide a safe default or BLANK to hide unreliable results.

Learning path

  1. Master BLANK, ISBLANK, and COALESCE for defaults.
  2. Use DIVIDE for any ratio to avoid errors.
  3. Use SELECTEDVALUE for labels and context-aware messages.
  4. Test behavior in visuals (table, matrix, line chart) to verify display logic.

Who this is for

  • BI Developers building stable, user-friendly Power BI models.
  • Data analysts who publish reports and need clean KPIs.
  • Anyone migrating Excel logic to robust DAX measures.

Prerequisites

  • Basic DAX: SUM, COUNTROWS, CALCULATE.
  • Familiarity with filter context (slicers, visuals).
  • A simple star schema with a Date table.

Next steps

  • Refactor existing measures to use DIVIDE and COALESCE where appropriate.
  • Add dynamic labels throughout your report using SELECTEDVALUE.
  • Document your blank/zero policy with examples for your team.

Mini challenge

You have [Churned Customers] and [Customers at Start]. Build Churn Rate % that:

  • Returns BLANK when [Customers at Start] is BLANK.
  • Returns 0 when [Customers at Start] = 0.
  • Otherwise DIVIDE([Churned Customers], [Customers at Start]).
Show a possible solution
Churn Rate % =
VAR StartCust = [Customers at Start]
RETURN IF(
    ISBLANK(StartCust),
    BLANK(),
    DIVIDE([Churned Customers], StartCust, 0)
)

Ready for the Quick Test

The Quick Test below is available to everyone. If you are logged in, your progress will be saved automatically.

Practice Exercises

2 exercises to complete

Instructions

Create a measure Profit Margin % (Strict) with this behavior:

  • If [Total Revenue] is BLANK: return BLANK().
  • If [Total Revenue] = 0 (but not BLANK): return 0.
  • Else: [Total Profit] / [Total Revenue].

Hint: Combine ISBLANK with DIVIDE.

Expected Output
Rows with no revenue show blank; rows with revenue exactly 0 show 0%; otherwise a valid percentage.

Handling Blanks And Errors — Quick Test

Test your knowledge with 8 questions. Pass with 70% or higher.

8 questions70% to pass

Have questions about Handling Blanks And Errors?

AI Assistant

Ask questions about this tool