Skip to content
BENIBIX Learn

Data Analysis Expressions (DAX)

Also known as DAX, DAX Formula, DAX Measure

The way to write sums and counts in Power BI.

Think of it like

It is like the sums you type in a sheet. But it works on a whole set of tables at once.

Example

A report shows sales and sales last year side by side. When the reader picks one store, both numbers change to that store.

Why it matters

A measure is written once and works under each filter. No one has to build the number again for each chart.

Definition

DAX is the formula language of Power BI. It looks like Excel formulas, but it works on whole tables and columns. Most DAX is written as measures. These are numbers worked out when someone looks at a chart. The same measure gives the right answer for each filter, such as one region or one month. A function like CALCULATE changes which rows a measure looks at.

Example code

dax
Total Sales = SUM ( Sales[Amount] )

Sales Last Year =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
Two measures. The second reuses the first and shifts the dates back one year.
The revenue rule in the middle box is the kind of thing DAX writes.

Common mistake

Writing a new column where a measure is needed. A column is fixed per row. A measure changes with each filter.

Key takeaways

  1. 1
    Excel-like. Familiar shape, works on tables.
  2. 2
    Measures. Worked out when the chart is drawn.
  3. 3
    Filter aware. Right for each region or month.

Compare