What Is DAX in Power BI? Complete Guide for Beginners

DAX
powerbiconsulting.com
DAX13 min read

What Is DAX in Power BI? Complete Guide for Beginners

Learn DAX (Data Analysis Expressions) — the formula language for Power BI. Understand measures, calculated columns, filter context, and essential functions.

By Errin O'Connor, Chief AI Architect

DAX (Data Analysis Expressions) is the formula language used in Power BI, Analysis Services, and Power Pivot for Excel. It's how you create custom calculations, KPIs, and business metrics that go beyond simple aggregations. With 390 monthly searches for "what is dax in power bi," it's a foundational topic every Power BI user needs to understand.

What Is DAX?

DAX is a collection of functions, operators, and constants that you use to create formulas (called expressions) in Power BI. Think of it like Excel formulas on steroids — but instead of operating on individual cells, DAX operates on entire columns and tables of data.

DAX vs. Excel Formulas | Feature | Excel | DAX | |---------|-------|-----| | Operates on | Cells (A1, B2) | Columns and tables | | Returns | Single value | Table or scalar value | | Context | Cell reference | Filter context | | Performance | Moderate | Optimized for millions of rows | | Relationships | VLOOKUP/INDEX | Automatic via model relationships |

Two Types of DAX Calculations

Measures (Recommended) Measures are calculated at query time based on the current filter context. They're dynamic — their result changes based on slicers, filters, and cross-filtering.

Total Revenue = SUM(Sales[Amount])

Profit Margin = DIVIDE(SUM(Sales[Profit]), SUM(Sales[Revenue]))

Use measures for: KPIs, aggregations, percentages, year-over-year calculations, anything that should respond to filters.

Calculated Columns Calculated columns compute a value for each row and store the result in the model. They're static and increase model size.

Full Name = Customers[FirstName] & " " & Customers[LastName]

Use calculated columns for: Row-level categorization, concatenation, or when you need to filter/sort by the calculated value.

Rule of thumb: If in doubt, use a measure. Measures are more performant and flexible.

Understanding Filter Context

Filter context is THE most important concept in DAX. Every DAX calculation runs within a context — the set of active filters that determine which rows of data are visible.

What Creates Filter Context? - Slicers — User selects "2026" in a year slicer - Visual axes — A bar chart with categories on the axis - Cross-filtering — Clicking a bar in one chart filters others - Report/page filters — Filters applied in the filter pane - Row context — In calculated columns, each row provides context

CALCULATE: The Most Important DAX Function

CALCULATE modifies filter context. It's used in 80%+ of non-trivial DAX formulas:

Sales Last Year = CALCULATE([Total Revenue], SAMEPERIODLASTYEAR(Dates[Date]))

Sales in USA = CALCULATE([Total Revenue], Customers[Country] = "USA")

CALCULATE takes a measure as its first argument, then one or more filter modifications that change the context.

Essential DAX Functions

Aggregation Functions - SUM(column) — Sum of all values - AVERAGE(column) — Average of all values - COUNT(column) — Count of non-blank values - DISTINCTCOUNT(column) — Count of unique values - MIN(column) / MAX(column) — Minimum/maximum value

Time Intelligence - TOTALYTD(measure, dates) — Year-to-date total - SAMEPERIODLASTYEAR(dates) — Same period in prior year - DATEADD(dates, -1, YEAR) — Shift dates by interval - DATESYTD(dates) — Returns dates from start of year to current date - PARALLELPERIOD(dates, -1, QUARTER) — Previous quarter

Filter Functions - CALCULATE(measure, filters) — Modify filter context - ALL(table) — Remove all filters from a table - FILTER(table, expression) — Return filtered table - VALUES(column) — Return distinct values in current context - SELECTEDVALUE(column) — Return single selected value

Table Functions - SUMMARIZE(table, groupby, name, expression) — Group and aggregate - ADDCOLUMNS(table, name, expression) — Add calculated columns to table - CROSSJOIN(table1, table2) — Cartesian product

Iterator Functions (X functions) - SUMX(table, expression) — Row-by-row sum - AVERAGEX(table, expression) — Row-by-row average - COUNTX(table, expression) — Row-by-row count - MAXX/MINX(table, expression) — Row-by-row max/min

Common DAX Patterns

Year-over-Year Growth YoY Growth % = VAR CurrentYear = [Total Revenue] VAR PriorYear = CALCULATE([Total Revenue], SAMEPERIODLASTYEAR(Dates[Date])) RETURN DIVIDE(CurrentYear - PriorYear, PriorYear)

Percentage of Total % of Total = DIVIDE([Total Revenue], CALCULATE([Total Revenue], ALL(Products)))

Running Total Running Total = CALCULATE([Total Revenue], FILTER(ALL(Dates), Dates[Date] <= MAX(Dates[Date])))

Top N Customers Top 10 Customer Sales = CALCULATE([Total Revenue], TOPN(10, ALL(Customers), [Total Revenue]))

For more patterns, see our essential DAX patterns guide and advanced DAX patterns.

Learning Path

  1. Week 1-2: SUM, AVERAGE, COUNT, basic measures
  2. Week 3-4: CALCULATE, filter context, ALL
  3. Month 2: Time intelligence, SAMEPERIODLASTYEAR, TOTALYTD
  4. Month 3: Iterator functions (SUMX, AVERAGEX), variables (VAR/RETURN)
  5. Month 4-6: Advanced patterns, performance optimization
  6. **Certification**: PL-300 exam prep

Getting Expert Help

DAX can be challenging, especially for complex business calculations. Our DAX optimization service helps enterprises write performant DAX for large-scale models. Contact our team for a consultation.

Frequently Asked Questions

Is DAX hard to learn?

DAX basics (SUM, AVERAGE, COUNT) are straightforward and similar to Excel. The learning curve steepens when you encounter filter context and the CALCULATE function — these concepts are unique to DAX and require a shift in thinking from cell-based formulas. Most people achieve basic proficiency in 2-4 weeks, but mastering advanced DAX patterns takes 3-6 months of practice. The key is understanding filter context, which is the foundation of all DAX calculations.

What is the difference between a measure and a calculated column in DAX?

A measure is evaluated at query time and responds to the current filter context (slicers, visual axes, page filters). A calculated column is computed once at data refresh time and stores a fixed value in every row. Measures are more flexible and performant — use them for KPIs, aggregations, and any dynamic calculation. Use calculated columns only when you need to filter, sort, or group by the calculated value.

What is CALCULATE and why is it so important?

CALCULATE is the most important DAX function because it lets you modify filter context — the set of active filters that determine which rows are visible for a calculation. Without CALCULATE, your measures always respect the current visual context. With CALCULATE, you can override filters (e.g., calculate Total Sales regardless of the year slicer selection using ALL), add filters (e.g., only USA sales), or shift time periods (e.g., same period last year).

Should I learn DAX or Power Query first?

Learn Power Query first. Power Query handles data extraction, cleaning, and transformation — it runs before DAX. A well-prepared dataset in Power Query reduces the amount of DAX you need to write. Many beginners try to solve data quality problems with DAX when they should be using Power Query. Once your data model is clean and properly structured (star schema), DAX becomes much simpler and more performant.

DAXPower BIformulasCALCULATEmeasuresfilter contexttime intelligence

Industry Solutions

See how we apply these solutions across industries:

Need Help With Power BI?

Our experts can help you implement the solutions discussed in this article.

Ready to Transform Your Data Strategy?

Get a free consultation to discuss how Power BI and Microsoft Fabric can drive insights and growth for your organization.