DAX DIVIDE function

Divides two numbers safely: returns blank (or a value you choose) instead of an error when dividing by zero.

Every ratio in a report (margin, share, growth) is a division. DIVIDE does the same as the / operator, but handles a zero or blank denominator without an error.

Syntax

DIVIDE(<numerator>, <denominator>[, <alternateresult>])
ArgumentRequiredDescription
numeratorRequiredThe number to divide.
denominatorRequiredThe number to divide by.
alternateresultOptionalWhat to return when the denominator is 0 or blank. Blank if left out.

Returns: A decimal number, the alternate result, or blank.

Examples

Calculated on the free practice data (table financials), with [Total Sales] = SUM(financials[Sales]) and [Total Profit] = SUM(financials[Profit]).

1. Profit margin by segment

Profit Margin = DIVIDE([Total Profit], [Total Sales])
SegmentProfit Margin
Channel Partners73.13%
Enterprise-3.13%
Government21.69%
Midmarket27.71%
Small Business9.77%
Total14.23%

Profit as a share of sales. Enterprise has a negative margin: it loses money on every sale.

Good to know

  • Use DIVIDE for ratios of measures. For dividing by a constant, like / 1000, the plain operator is fine and slightly faster.
  • Set the measure's format to Percentage in Power BI: DIVIDE returns 0.1423, not 14.23.

Related functions

Official reference: DIVIDE function on Microsoft Learn