Skip to content
VirtualLP Virtual Learning Platform

DAX Basics: Measures, Columns, SUMX and DIVIDE

8 min read Topic 14 of 38 3 hands-on labs

Understand it in simple language

A calculated column is evaluated for rows during model processing and stored. A measure is evaluated when a query needs it under the current filters. Use measures for aggregations that must react to slicers. SUM adds a column. SUMX loops over table rows, evaluates an expression and adds its results.

Create separate measures:

Revenue = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])
Cost = SUMX(Sales, Sales[Quantity] * Sales[UnitCost])
Profit = [Revenue] - [Cost]
Margin = DIVIDE([Profit], [Revenue])
Orders = DISTINCTCOUNT(Sales[OrderID])

Format Revenue, Cost and Profit as currency and Margin as percentage. DIVIDE handles a zero denominator without an uncontrolled divide error.

Do it step by step

Create each measure separately with New measure. Put all five in cards. With no filters the clean data gives Revenue 2300, Cost 1380, Profit 920, Margin 40%, and Orders 3. Browser lab: Calculate revenue and profit. Then filter North: Revenue 1250 and Profit 500.

Check your result

Why does SUM(UnitPrice) give the wrong revenue? It ignores quantities and the meaning of the rows.

If something goes wrong

If Sales is an invalid table name, check the query name in the Data pane. Avoid a calculated column named exactly like a measure.

Practice data and learning method

Industry practice collection: downloadable retail, finance, HR and operations datasets, dictionaries, full walkthroughs and answer sheets. The cases contain multiple years, multiple related tables, deliberate data defects and known-answer checks. Progress from the small foundation files below to these cases; do not reuse the foundation totals for the larger datasets.

Download Sales.csv, Products.csv, and the dataset guide. These files contain synthetic training data, not real customers. Use the Power BI virtual labs for guided browser practice. Each lab states its supported operations. Then repeat the procedure above in the actual Microsoft tools and save evidence of your result. Try another filter or an intentionally incorrect setting and explain what changed before moving on.

Guided practicals for this topic

Virtual lab · Microsoft Power BI · 25 min

Calculate revenue, profit and margin

Guided browser practice with visible data, checked actions and expected results. Repeat the linked tutorial in Power BI Desktop.

Open lab

Virtual lab · Microsoft Power BI · 35 min

Calculate discounted revenue on 18,000 lines

Hands-on retail case: load the downloadable CSV tables, perform the actions, inspect the full-data result and reconcile it. Includes a paired Desktop procedure.

Open lab

Virtual lab · Microsoft Power BI · 35 min

Calculate profit and weighted margin

Hands-on retail case: load the downloadable CSV tables, perform the actions, inspect the full-data result and reconcile it. Includes a paired Desktop procedure.

Open lab

Continue learning from Microsoft

Power BI documentation · DAX reference · Power Query M reference · Power BI analyst skills map. Features, licensing, menus and availability can change; check the relevant official page for your environment.

Practise this topic

Hands-on virtual labs

Apply what you just read in a realistic, guided simulation. Free with a verified account.

Create a free account to track your progress and unlock virtual labs.