Ravindra BagaleCourses & study guides Track your progress

Guides

What Is DAX? A Beginner Guide for Power BI

DAX (Data Analysis Expressions) is the formula language Power BI uses over your model tables. Start with simple measures like SUM, put them on visuals, and watch filter context change the result.

Friends! DAX sounds heavy until you write one honest measure. Why learn it? Because charts without measures are just raw columns. How? New measure → SUM → Card → slicer. Tiny example on FreshBasket Amount. Do not worry — we walk slowly.

Quick answer

Beginner path (vertical):

  1. Load a clean fact table with a numeric column.
  2. New measure on that table.
  3. Total Sales = SUM ( Sales[Amount] ) (names must match yours).
  4. Drop the measure on a Card.
  5. Add a slicer; confirm the card changes.
  6. Only then explore IF, CALCULATE, SUMX.
Model tables → DAX measure → visual Values → filters change the number

What do I need before this guide?

Before and after (look at the tables first)

Before slicer All three rows; measure total 190.

Before

After Mumbai slicer Mumbai rows only; total 150.

After

Your first DAX measure is usually SUM ( Sales[Amount] ). Same formula; slicers change which rows it sees — Mumbai → 150.

Why DAX exists (not Excel sheet formulas)

Excel formulas live on a grid of cells (=B2+C2). DAX lives on tables and relationships.

Why you care:

  1. You rarely write A1-style addresses.
  2. You write Table[Column] references.
  3. Visuals bring filter context — the same measure can return different numbers when Mumbai is selected.
  4. That is a feature, not a bug.

Tiny table for this whole page:

City Amount
Mumbai 100
Pune 40
What DAX is for DAX writes formulas over your model tables to produce measures and calculated columns. Model tables DAX formulas Numbers / text SUM

DAX is the formula language over your model tables — it powers measures, calculated columns and some tables.

Where you type DAX in Desktop

Where DAX appears in Desktop New measure on the ribbon, formula bar, and Fields list. Ribbon New measure Formula bar type DAX here Fields fx icon

In Desktop you create measures from the ribbon, edit them in the formula bar, and find them under Fields with an fx icon.

What this is: the places in Desktop where formulas live.

Why you care: if IntelliSense does not show your column, you are usually on the wrong name or wrong table.

Vertical map:

  1. Ribbon — New measure / New column.
  2. Formula bar — the editor with IntelliSense (suggestions as you type).
  3. Fields pane — measures appear with an fx-style marker.
  4. Model view — good for seeing which table owns the measure.

What you see on screen: after you create [Total Sales], Fields shows it under Sales with an fx icon.

Anatomy of a first measure — WHY SUM, WHAT happens

Parts of a DAX measure Name, equals sign, function, and column reference. Name = Function Column ref Total Sales = SUM ( Sales[Amount] )

Measure anatomy: Name = Function ( Table[Column] ), for example Total Sales = SUM ( Sales[Amount] ).

Why use SUM

  1. You already have a numeric column (Amount).
  2. You want one total that respects slicers.
  3. You do not need to multiply Qty × Price first (that is SUMX later).

The formula

Total Sales = SUM ( Sales[Amount] )

Vertical breakdown:

  1. Total Sales — measure name (what readers see unless you rename the visual).
  2. = — starts the expression.
  3. SUM — add the numbers in a column.
  4. Sales[Amount] — column reference (table then column).

What Power BI does to the rows (step by step)

  1. Look at the Sales table under the current filters.
  2. With no slicer: both rows are visible (Mumbai 100, Pune 40).
  3. Add Amount: 100 + 40.
  4. Return 140 to the Card.
  5. Reader selects City = Mumbai.
  6. Only the Mumbai row remains.
  7. SUM runs again → 100.

What you see on screen

  1. Card shows 140.
  2. After Mumbai slicer → Card shows 100.
  3. Clear slicer → 140 again.

Common first variants:

Order Count = COUNTROWS ( Sales )
Average Amount = AVERAGE ( Sales[Amount] )

What happens for COUNTROWS on our table: no slicer → 2 rows; Mumbai only → 1 row.

DAX is not only SUM

You will meet families over time:

  1. Aggregations — SUM, AVERAGE, MIN, MAX, COUNTROWS.
  2. Logic — IF, SWITCH.
  3. Filter modifiers — CALCULATE (next guide).
  4. Iterators — SUMX (separate guide).
  5. Time intelligence — after a Date table exists.

Do not memorise the whole function list on day one. Memorise the habit: measure → visual → slicer test.

Tiny FreshBasket classroom example (end to end)

  1. Table Sales with City + Amount (Mumbai 100, Pune 40).
  2. Measure [Total Sales] = SUM ( Sales[Amount] ).
  3. Card shows 140.
  4. Slicer City = Mumbai → card shows 100.
  5. That change is filter context teaching you without a textbook.

Errors beginners see

Message / symptom Meaning What to try
Red underline on name Typo in table/column Retype with IntelliSense
Blank card Filters removed all rows / wrong field Clear filters; check Data view
Same number everywhere Using a column where a measure belongs Use a measure in Values
Circular dependency Measures/columns referencing badly Simplify; avoid spaghetti

Ravindra Bagale's Tip

Students paste 20-line DAX from the internet on day one. Write SUM yourself. Then IF. Then CALCULATE. Ownership beats copy-paste in interviews. Got it?

Lab

  1. Create [Total Sales], [Order Count], [Average Amount] on Mumbai 100 / Pune 40 data.
  2. Three cards on one page.
  3. City slicer.
  4. Note how each card reacts (Total Sales should go 140 → 100 for Mumbai).
  5. Rename measures to clear business names.

Excel vs DAX — one honest comparison table

Excel habit DAX habit
=SUM(B2:B100) SUM ( Sales[Amount] )
Filter the sheet manually Slicers + filter context
Copy formula down a column Calculated column or measure (choose carefully)
PivotTable cache Model relationships + measures

Naming discipline

  1. Measures: Total Sales, Order Count — business language.
  2. Avoid Measure 1.
  3. Keep table names stable (Sales, not Table1) via Power Query rename.

Mini practice script (15 minutes)

  1. Create three measures: sum, average, countrows.
  2. Three cards.
  3. One slicer.
  4. Change slicer five times; predict the card before it renders (Mumbai → sales 100).
  5. Prediction practice builds filter-context instinct early.

Formula bar survival tips

  1. Press Enter to commit; Shift+Enter for new lines in longer formulas (version-dependent — watch the UI).
  2. Use IntelliSense; do not invent column names from memory.
  3. If the measure vanishes from Fields, you may have created it on the wrong table — check Model view home table.
  4. Comment sparingly with // in longer measures later.

Readability with variables (preview)

Gross Margin % =
VAR Gross = [Total Sales] - [Total Cost]
VAR Sales = [Total Sales]
RETURN
DIVIDE ( Gross, Sales )

You do not need VAR on day one, but seeing it early removes fear when the course introduces it.

Got it? DAX = formulas on the model. Start with measures and SUM. Test with a slicer. Next: CALCULATE. Let’s continue.

Frequently asked questions

What does DAX stand for?

Data Analysis Expressions — Microsoft’s formula language for Power BI, Analysis Services and Power Pivot.

Is DAX the same as Excel?

Some function names look familiar (SUM, IF) but DAX works on tables and filter context, not on A1 cell addresses.

Measure vs calculated column again?

Beginners should start with measures for totals. Columns are for row-level fields.

Do I need to learn M and DAX together?

Learn enough Power Query to load clean tables, then focus DAX on measures.

Where do I see all measures?

In the Fields pane — often marked with an fx icon — and in Model view.

Next DAX topics?

CALCULATE and filter context, then SUM vs SUMX — separate guides on this site.