# Data Analysis Expressions (DAX)

> The way to write sums and counts in Power BI.

**Field:** Data Engineering  
**Category:** Analytics & BI  
**Also known as:** DAX, DAX Formula, DAX Measure

## 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.

## 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

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

## 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.

## Why it matters

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

## Common mistake

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

## Three principles

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

## Related terms

- [Power BI](https://learn.benibix.com/term/data/power-bi)
- [Measure (Analytics)](https://learn.benibix.com/term/data/measure)
- [Semantic Layer](https://learn.benibix.com/term/data/semantic-layer)
- [LookML](https://learn.benibix.com/term/data/lookml)
- [Power Query](https://learn.benibix.com/term/data/power-query)

## Told apart from

- [Power Query vs DAX](https://learn.benibix.com/compare/power-query-vs-dax): People think Power Query and DAX are two names for one Power BI language. Power Query gets the data and cleans it before it is loaded. DAX works on the data after it is loaded, to add up numbers like total sales or growth on last year. Clean the rows with Power Query, then do the math with DAX.

![Warehouse tables on the left feed a semantic layer in the middle, which holds one definition of revenue as the sum of amount, plus dimensions for country and month. Three tools on the right, a dashboard, a spreadsheet and an AI assistant, all ask for revenue and all get the same number.](https://learn.benibix.com/diagrams/semantic-layer.svg)

---

Source: https://learn.benibix.com/term/data/dax
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
