Power BI

DAX for Beginners: A Practical Guide for Power BI

By Claribel Val · September 2, 2025 · 5 min read


If you're taking your first steps in Power BI, at some point you'll come across the acronym DAX. This language can seem intimidating at first, but with the right guidance it becomes one of the most powerful tools you can master to build high-impact analytical reports.

In this article we explain what DAX is, what it's used for, which are the most important formulas, and how to start applying them in your Power BI reports from day one.

What Is DAX?

DAX, which stands for Data Analysis Expressions, is the formula language used by Power BI (as well as Power Pivot in Excel and Analysis Services) to create custom calculations. Unlike Excel formulas, DAX is designed to work with related tables and dynamic filter contexts.

With DAX you can:

  • Create calculated measures that automatically recalculate based on the filters applied in a report.
  • Define calculated columns that add static information to a table row by row.
  • Build calculated tables generated dynamically from other tables.

The most important difference from Excel is that DAX always operates within a filter context. This means that the result of a formula varies depending on which elements are selected in the report at any given moment, enabling the powerful cross-filtering that makes Power BI so useful.

Measures vs. Calculated Columns: Which One to Use?

Before writing your first DAX formula, it's essential to understand this distinction:

  • Measures: calculated at visualization time, they respond to report filters and don't store data in the model. They are the preferred option for totals, averages, ratios, and any calculation that must adapt to the current context.
  • Calculated columns: calculated row by row when the model loads, stored in memory, and don't change with filters. They are useful for classifications, concatenations, or derived values that don't depend on the visualization context.

The general rule: if you need a value that changes based on what the user filters, use a measure. If you need a fixed value per row, use a calculated column.

Essential DAX Formulas to Get Started

Below you'll find the most commonly used functions for those learning DAX, with practical examples applied to a sales model.

SUM and SUMX

SUM is the simplest function: it sums all values in a numeric column within the current filter context.

Total Sales = SUM(Sales[Amount])

SUMX is more powerful: it iterates row by row and allows you to apply an expression before summing.

Sales with Discount = SUMX(Sales, Sales[Quantity] * Sales[Price] * (1 - Sales[Discount]))

CALCULATE

CALCULATE is probably the most important function in DAX. It allows you to modify the filter context to evaluate an expression under specific conditions.

Sales 2025 = CALCULATE(SUM(Sales[Amount]), Dates[Year] = 2025)

North Region Sales = CALCULATE([Total Sales], Regions[Region] = "North")

FILTER

FILTER returns a filtered table based on a condition. It is frequently used inside CALCULATE to apply complex filters.

VIP Customer Sales = CALCULATE(
    SUM(Sales[Amount]),
    FILTER(Customers, Customers[Category] = "VIP")
)

DIVIDE

It is best practice to use DIVIDE instead of the / operator, as it automatically handles errors caused by division by zero.

Margin % = DIVIDE([Gross Profit], [Total Sales], 0)

IF and SWITCH

For conditional logic, IF and SWITCH are your go-to functions.

Sale Classification = IF(Sales[Amount] >= 10000, "High", "Standard")

Quarter = SWITCH(
    Dates[Month],
    1, "Q1", 2, "Q1", 3, "Q1",
    4, "Q2", 5, "Q2", 6, "Q2",
    7, "Q3", 8, "Q3", 9, "Q3",
    "Q4"
)

Time Intelligence with DAX

One of DAX's most valued capabilities is handling time-based calculations. To use them correctly, you need a properly marked date table in your model.

TOTALYTD, TOTALMTD, and TOTALQTD

These functions calculate cumulative totals from the start of the year, month, or quarter to the current date in the context.

Sales YTD = TOTALYTD(SUM(Sales[Amount]), Dates[Date])

Sales MTD = TOTALMTD(SUM(Sales[Amount]), Dates[Date])

SAMEPERIODLASTYEAR

Compares the current period to the same period of the previous year — very useful for growth analysis.

Previous Year Sales = CALCULATE(
    SUM(Sales[Amount]),
    SAMEPERIODLASTYEAR(Dates[Date])
)

YoY Growth % = DIVIDE(
    [Total Sales] - [Previous Year Sales],
    [Previous Year Sales],
    0
)

The Evaluation Context: The Key to Understanding DAX

The most important — and most confusing — concept in DAX is the evaluation context. There are two types:

  • Row context: applies when a calculated column is evaluated. DAX knows which row of the table is being processed.
  • Filter context: applies when a measure is evaluated. It is the set of active filters coming from slicers, charts, tables, and cross-filtering between visuals.

Cross-filtering in Power BI amplifies the filter context automatically: when you click a bar in a chart, all other visuals filter accordingly. This means your DAX measures automatically recalculate to reflect the selection, without any additional work on your part.

Best Practices for Writing DAX

  • Name your measures clearly: use descriptive names like Total Sales, not Measure1.
  • Use readable formatting: when writing long formulas, put each argument on a new line.
  • Prefer measures over calculated columns whenever possible to optimize model performance.
  • Organize measures in dedicated tables (empty tables used only to hold measures) to keep the model tidy.
  • Comment your code: use -- to add comments in complex formulas.

Where to Go Next?

Mastering DAX takes time and practice. The best way to learn is to apply these formulas to real data. We recommend starting with a simple sales model, creating basic measures, and gradually increasing complexity.

If you already have a Power BI model and want to move on to more advanced calculations — such as running totals, dynamic rankings, or cohort analysis — the team at Okun Data can help you take your reports to the next level.

Want to Apply DAX in Your Business?

Our team designs custom data models and DAX formulas so you get the insights you need. Request a free demo.

Request a Demo

Frequently Asked Questions

What is the difference between a measure and a calculated column in DAX?
Measures are calculated at visualization time and respond dynamically to report filters, making them ideal for totals, averages, and ratios. Calculated columns are evaluated row by row when the model loads and store fixed values, making them useful for classifications or derived values that don't change with the filter context.
Why is CALCULATE so important in DAX?
CALCULATE is the most powerful function in DAX because it allows you to modify the filter context in which an expression is evaluated. This lets you compute values under specific conditions — such as sales for a particular year or a specific region — regardless of the filters currently active in the report.
Do I need programming experience to learn DAX?
No programming experience is required to learn DAX. If you are already comfortable with Excel formulas, you have a strong foundation to get started. DAX has a clear and consistent syntax, and with essential functions like SUM, CALCULATE, DIVIDE, and the time intelligence functions, you can cover most common business use cases.

Related Articles

Need Help with DAX?

Our Power BI specialists can build custom DAX measures and models tailored to your business needs.

Contact Us
Get your free prototype