Back to Roadmap
Level 5 — Real-World DAX Patterns+75 XP
Lesson 2

2. Safe Division with DIVIDE

Never use the '/' operator for dividing measures.

The Concept

DIVIDE automatically handles division by zero and blanks, returning BLANK() or an alternate value.
Example DAX:
Profit Margin % = 
DIVIDE(
    [Total Margin],
    [Total Revenue],
    0
)

Using [A] / [B] will return NaN or crash if [B] is 0 or Blank. DIVIDE is mathematically safe and recommended by Microsoft.

Try It Yourself

Calculate Profit Margin using DIVIDE with [Total Margin] and [Total Revenue], defaulting to 0.

fx
[fx]Safe Division with DIVIDE=
Loading DAX Formula Studio...
Type [ for fields