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>])| Argument | Required | Description |
|---|---|---|
| numerator | Required | The number to divide. |
| denominator | Required | The number to divide by. |
| alternateresult | Optional | What 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])| Segment | Profit Margin |
|---|---|
| Channel Partners | 73.13% |
| Enterprise | -3.13% |
| Government | 21.69% |
| Midmarket | 27.71% |
| Small Business | 9.77% |
| Total | 14.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