DAX (Data Analysis Expressions) is Power BI's formula language. It looks like Excel formulas but thinks in tables and columns rather than cells. You'll write two kinds of calculation:

In Module 1 you made a Line Total calculated column. It works, but every column you add makes the model bigger. Measures are calculated only when a visual asks — for each branch, month or product on the visual — and take no storage. Rule of thumb: if you'll show it as a number, make it a measure.
Your first measure
Select the Sales table → Home → New measure, and type in the formula bar:
Revenue (all) = SUMX ( Sales, Sales[Quantity] * Sales[Unit Price] )
SUMX is an iterator: it goes through Sales row by row, multiplies Quantity by Unit Price, then adds up the results. Put it on a card: ₦53,175,300 — the same as Module 1's column, without the column.
Delivered revenue
Cancelled and pending orders aren't sales. The measure the business actually wants:
Revenue = CALCULATE ( [Revenue (all)], Sales[Status] = "Delivered" )
₦47,738,300 for all time. You'll learn CALCULATE properly in the next lesson; for now, read it as Revenue (all), but only where Status is Delivered. Notice it reuses [Revenue (all)] — measures build on measures.
Count and average
Orders = CALCULATE ( DISTINCTCOUNT ( Sales[Order ID] ), Sales[Status] = "Delivered" )
Avg Order Value = DIVIDE ( [Revenue], [Orders] )
DISTINCTCOUNTbecause Sales has one row per line: order 1 has four lines but is one order. That gives 2,708 orders.DIVIDEis safe division: if Orders is zero or blank it returns blank instead of an error. Always use DIVIDE rather than/in measures. Avg Order Value = ₦17,629.
Keep measures tidy
- Format each measure: select it → Measure tools → Currency (₦) / Whole number / Percentage, with sensible decimals.
- Name them like a business user would: Revenue, Avg Order Value — not Sum of Line_Total_2.
- Home table: put measures in a dedicated table. Home → Enter data → name it _Measures → Load, then move each measure to it (Measure tools → Home table). It sorts to the top of the Data pane.
- Comments:
// Delivered orders onlyat the end of a line, or on its own line.
Check yourself
Answer in your head first, then open each question to see the answer and why.
When should you use a measure instead of a calculated column?
- A For numbers you show and aggregate — totals, averages, ratios
- B For text you filter by
- C Never
- D Only for dates
Show the answer
A) For numbers you show and aggregate — totals, averages, ratios — Measures calculate on the fly for the context of the visual.
What does SUMX(Sales, Sales[Quantity] * Sales[Unit Price]) do?
- A Multiplies quantity by price on each row, then sums the results
- B Sums quantity and sums price, then multiplies
- C Counts rows
- D Finds the maximum
Show the answer
A) Multiplies quantity by price on each row, then sums the results — X functions iterate row by row.
Why use DISTINCTCOUNT(Sales[Order ID]) to count orders?
- A Sales has one row per order line, so orders repeat
- B COUNT doesn't exist
- C It's faster
- D To exclude cancelled orders
Show the answer
A) Sales has one row per order line, so orders repeat — Count each order once.
Why use DIVIDE instead of /?
- A It returns blank instead of an error when dividing by zero
- B It rounds automatically
- C It's required for percentages
- D It's shorter
Show the answer
A) It returns blank instead of an error when dividing by zero — DIVIDE handles zero and blank safely.
More free lessons: What Power BI is, and why employers want it · Install Power BI Desktop and find your way around · Getting data: Excel, CSV, folders and more · Star schema: facts and dimensions · Choosing the right visual · Design principles for dashboards people use · The Power BI Service and licences