Dividing with DIVIDE

Many KPIs are ratios: sales per order, price per unit, share of the total. DIVIDE divides like the slash, but copes with a denominator of 0.

In short: DIVIDE(numerator, denominator) divides and returns blank when the denominator is 0 or blank. A third argument decides what appears instead, for example DIVIDE(a, b, 0).

Before this: Measures with SUM, COUNTROWS and DISTINCTCOUNT.

Try it now

Task Create the measure "Avg Order Value": [Total Sales] divided by the number of rows in Sales, using DIVIDE.

Sales 120 rows, 7 columns
OrderIDOrderDateShipDateProductIDRegionIDQuantityAmount
13 Oct 20266 Oct 20261221798
29 Nov 202519 Nov 20252351145
320 Sep 202627 Sep 2026544596
416 Jun 20252 Jul 20252151145
526 Mar 202631 Mar 20261343596
64 Dec 202510 Dec 2025545745
78 Jul 202526 Jul 2025614196
820 Feb 20251 Mar 202532359.7
99 Dec 202524 Dec 202562298
1012 Aug 202625 Aug 2026212458
117 Sep 202612 Sep 2026542298
122 Mar 202614 Mar 2026623147

Showing the first 12 of 120 rows.

Measures: [Total Sales]

Product 6 rows, 4 columns
ProductIDProductCategoryPrice
1LaptopHardware899
2MonitorHardware229
3MouseAccessories19.9
4KeyboardAccessories39.9
5Office suiteSoftware149
6AntivirusSoftware49
Region 4 rows, 2 columns
RegionIDRegion
1North
2South
3West
4East
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

Showing the first 12 of 730 rows.

DIVIDE or slash?

When DAX divides by 0 with /, the result is infinity, and 0 divided by 0 even gives NaN (not a number). A matrix then shows odd values as soon as a filter creates a cell without data. DIVIDE returns blank in these cases, and Power BI hides blank cells in visuals.

FormulaResult
1 / 0Infinity
0 / 0NaN
DIVIDE(1, 0)blank
DIVIDE(1, 0, 0)0

The slash is faster when the denominator can never be 0, for example a fixed number as in [Total Sales] / 1000. For anything that comes from data, DIVIDE is the safe choice.

Which average?

Dividing is often the better way to build an average. Total sales divided by total quantity gives the price per unit, weighted by quantity. AVERAGE over a column of unit prices treats every order the same, whether it was one unit or five. Both can be right, depending on the question.

Task What does one unit sold bring in on average? Create the measure "Price per Unit": [Total Sales] divided by the sum of Sales[Quantity].

Sales 120 rows, 7 columns
OrderIDOrderDateShipDateProductIDRegionIDQuantityAmount
13 Oct 20266 Oct 20261221798
29 Nov 202519 Nov 20252351145
320 Sep 202627 Sep 2026544596
416 Jun 20252 Jul 20252151145
526 Mar 202631 Mar 20261343596
64 Dec 202510 Dec 2025545745
78 Jul 202526 Jul 2025614196
820 Feb 20251 Mar 202532359.7
99 Dec 202524 Dec 202562298
1012 Aug 202625 Aug 2026212458
117 Sep 202612 Sep 2026542298
122 Mar 202614 Mar 2026623147

Showing the first 12 of 120 rows.

Measures: [Total Sales]

Product 6 rows, 4 columns
ProductIDProductCategoryPrice
1LaptopHardware899
2MonitorHardware229
3MouseAccessories19.9
4KeyboardAccessories39.9
5Office suiteSoftware149
6AntivirusSoftware49
Region 4 rows, 2 columns
RegionIDRegion
1North
2South
3West
4East
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

Showing the first 12 of 730 rows.

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

The first exercise in this lesson is free.

In real Power BI

  1. Create a new measure and type Avg Order Value = DIVIDE([Total Sales], COUNTROWS(Sales)).
  2. Under Measure tools, set the format and the decimal places; for shares, choose the Percentage format.

Common mistakes

Numerator and denominator swapped

DIVIDE divides the first argument by the second. DIVIDE(COUNTROWS(Sales), [Total Sales]) returns orders per unit of currency instead of sales per order.

0 as the alternate result where blank would be better

With DIVIDE(a, b, 0), rows without data appear too, with a 0. Sometimes that is intended, but often it just adds clutter.

FAQ

Can DIVIDE divide columns?

Yes, in a calculated column, for example DIVIDE(Sales[Amount], Sales[Quantity]). In a measure, though, numerator and denominator must be single values, so measures or aggregations like SUM.

Up next: IF and SWITCH

Classifying values and returning text depending on the result.

Next lesson

Write to us

Choose language

Select your preferred language