Your first measure in Power BI

A measure is a DAX formula that Power BI recalculates in every cell. It gives you KPIs you can reuse in any visual. Here you write your first three.

In short: Total Quantity = SUM(Sales[Quantity]). The name on the left, then an equals sign, the formula on the right. Arguments are separated by commas. Columns are written with their table in front, measures only in square brackets.

Prerequisites: Filters and slicers.

Try it now

Write the formula after the equals sign. While you type, the editor suggests functions and columns, and Tab takes the first suggestion. Run shows the matrix with your measure.

Task Create the measure "Total Quantity": the sum of the column Sales[Quantity]. The matrix then shows it next to [Total Sales] per category.

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.

How a measure is built

Total Quantity = SUM(Sales[Quantity])
PartMeaning
Total Quantityname of the measure. Spaces are allowed. In the report and in other formulas it is then called [Total Quantity].
=separates the name from the formula
SUM( )the function, here the sum of a column
Sales[Quantity]the Quantity column of the Sales table

The measure does not store a number, only the calculation. Power BI only evaluates it in the visual, for every cell with that cell's filters. That is why the same measure shows the quantity of hardware orders in the Hardware row and the quantity of all orders in the total row.

Count rows with COUNTROWS

COUNTROWS counts how many rows of a table are left in the filter of the cell. It takes the table itself, not a column.

Task Create the measure "Order Count": how many rows the Sales table has. Each row is one order.

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.

Measure instead of summarization

In the lesson Create a visual, Power BI summarized columns by itself. A measure of your own has three advantages: it has a meaningful name, you can use it in every visual, and other measures can build on it. Order Value = [Total Sales] / [Order Count] calculates on with two measures. That is why experienced Power BI users create a measure for every KPI.

Find the error

If you come from SQL, you might type its function names. Read the message carefully.

Task Find the error: the measure should show the average amount per order, but Power BI reports an error. Fix the formula.

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.

In real Power BI: create a measure

  1. Pick the table: in the Data pane, click the table the measure should live in, usually the Sales fact table.
  2. New measure: on the ribbon under Home or Modeling. The formula bar appears at the top with Measure = .
  3. Write the formula and confirm with Enter. Power BI suggests functions, tables and columns while you type.
  4. Use it: the measure appears in the Data pane with a calculator icon and can be dragged into a visual like any field.

Common mistakes

Function names from other tools

AVG, MEAN or SUMME do not exist in DAX. Power BI reports "Failed to resolve name". The names are the same as in English Excel: SUM, AVERAGE, COUNT.

Semicolon instead of comma

Some European versions of Excel separate arguments with semicolons. In DAX it is the comma by default.

Column without its table

SUM([Quantity]) does calculate as long as the measure lives in the Sales table. In the formula, though, the column looks like a measure and readers have to guess. The usual convention is therefore: columns always with their table (Sales[Quantity]), measures always without ([Total Sales]).

Column instead of table in COUNTROWS

COUNTROWS(Sales[OrderID]) reports that a single value for the column cannot be determined. COUNTROWS wants the table itself: COUNTROWS(Sales).

Column without a function

Total Quantity = Sales[Quantity] does not work in a measure: which of the many rows would be meant? A measure needs a function that turns many values into one.

Frequently asked questions

What is DAX?

DAX (Data Analysis Expressions) is the formula language of Power BI, Power Pivot in Excel and Analysis Services. It looks like Excel formulas but calculates over whole tables and filters instead of cell references.

Measure or calculated column?

A calculated column calculates once per row and stores the result. A measure only calculates in the visual, per cell. For sums, counts and ratios a measure is almost always right. Level 3 explains the difference in detail.

Up next: sales report project

Combine a measure, a matrix, a bar chart and a card into a report for management.

Go to the project

Write to us

Choose language

Select your preferred language