Calculations & VisualsExtra· 40 min read

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 columnMeasure
Works onOne row at a timeMany rows summarised
Stored?Yes, in the tableNo — worked out on the fly
Reacts to filters?NoYes — recalculates per chart/slicer
Use forA 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:

Your first DAX measure: add up the Amount column
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

Two more one-line measures using built-in DAX functions
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?

Answer: A measure produces one summarised number (sum, average, count) and recalculates depending on the filters and groupings around it, unlike a fixed per-row calculated column.

✍️ Practice

  1. Create the measure Total Sales = SUM(Sales[Amount]) and drop it into a card.
  2. Add an Order Count = COUNTROWS(Sales) measure and check it equals your number of rows.

🏠 Homework

  1. Write a measure for the average amount, then put it next to Total Sales and explain why each shows a different value.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →