Measures & Your First DAX Formula
A measure is a smart calculation like Total Sales that recalculates itself for whatever you are looking at.
What you will learn
- Tell a measure apart from a calculated column
- Write your first DAX measure with SUM
- Understand why measures react to filters
Measures vs calculated columns
A calculated column works one row at a time. A measure is different: it summarises many rows into one number — a total, an average, a count — and it recalculates automatically depending on what is on screen.
| Calculated column | Measure | |
|---|---|---|
| Works on | One row at a time | Many rows summarised |
| Stored? | Yes, in the table | No — worked out on the fly |
| Reacts to filters? | No | Yes — recalculates per chart/slicer |
| Use for | A per-row value (tax, label) | Totals, averages, counts (Total Sales) |
Writing your first measure
Let us make a Total Sales measure. In the Data view, click the Sales table, then on the ribbon click New Measure. Type this DAX formula:
Total Sales = SUM(Sales[Amount])Note: Output: A new measure named Total Sales appears with a small calculator icon. Using our four sample rows (1200, 450, 8900, 1200), it shows 11750. SUM adds up the whole Amount column — but only for the rows currently in view.
Why measures feel magic
The clever part is the words “currently in view”. The very same Total Sales measure gives different answers in different places, because it respects whatever filters and groupings are around it:
- In a card on its own → it shows the grand total, 11750.
- In a bar chart by Region → it shows the total for each region separately.
- With a slicer set to “North” → it shows only North’s total, 10100.
You write the measure once, and Power BI re-runs it for every slice you ask about. That is why a single dashboard can answer dozens of questions.
A couple more handy measures
Average Sale = AVERAGE(Sales[Amount])
Order Count = COUNTROWS(Sales)Note: Output: Average Sale shows 2937.5 (the mean of 1200, 450, 8900, 1200), and Order Count shows 4 (there are four rows). Like Total Sales, both update automatically when a slicer or chart narrows the data.
Tip: Read DAX out loud: SUM(Sales[Amount]) is “sum of the Amount column in the Sales table”. The pattern is always Function(Table[Column]).
Watch out: Type SUM(Sales[Amount]), not SUM(Amount). DAX needs the table name in front of the column in square brackets so it knows exactly which column you mean.
Q. What makes a measure different from a calculated column?
✍️ Practice
- Create the measure
Total Sales = SUM(Sales[Amount])and drop it into a card. - Add an
Order Count = COUNTROWS(Sales)measure and check it equals your number of rows.
🏠 Homework
- Write a measure for the average amount, then put it next to Total Sales and explain why each shows a different value.