Select Page
Click here to search in website

DAX Basics in Power BI: How to Write Your First Data Analysis Expressions

Power BI is one of the most in-demand business intelligence tools in the world — and at the heart of its analytical power lies DAX: Data Analysis Expressions. If you’re using Power BI to create dashboards and reports but haven’t yet dived into DAX, you’re missing out on its most powerful capabilities.

At IACT, our Power BI training courses cover everything from building your first report to writing advanced DAX calculations and building professional data models. This article introduces you to the fundamentals of DAX and shows you how to start writing your own calculations today.


What Is DAX?

DAX stands for Data Analysis Expressions. It is the formula language used in Power BI, Power Pivot, and Analysis Services to create custom calculations, aggregations, and business logic. Think of DAX like a supercharged version of Excel formulas — but designed to work with entire tables of data rather than individual cells.

DAX enables you to:

  • Create calculated columns — new columns computed from existing data
  • Create measures — dynamic calculations that change based on filters and slicers
  • Write calculated tables — virtual tables derived from existing data

Your First DAX Measures: The Basics

Simple Aggregations

The most common DAX measures use aggregation functions:

Total Sales = SUM(Sales[Amount])
Average Order Value = AVERAGE(Orders[OrderTotal])
Number of Customers = DISTINCTCOUNT(Sales[CustomerID])

Using CALCULATE — The Most Important DAX Function

CALCULATE is the cornerstone of DAX. It evaluates an expression in a modified filter context — eaning you can change what data is included in your calculation.

// Sales for the year 2025 only
Sales 2025 = CALCULATE SUm(Sales[Amount]), YEAR(Sales[Date]) = 2025)

// Sales for product category "Electronics" only
Electronics Sales = CALCULATE CARCUBÀIUQQN[Total Sales], Products[Category] = "Electronics")

Time Intelligence Functions

DAX has powerful built-in time intelligence functions for period comparisons0

// Year-over-year comparison
Sales LY = CALCULATE([Total Sales], SAMEPERIODLASTYEAR(Dates[Date]))

// Year-to-date totals
Sales YTD = TOTALYTD([Total Sales], Dates[Date])

// Month-to-date
Sales MTD = TOTALMTD_[Total Sales], Dates[Date])

Calculated Columns vs Measures: What’s the Difference?

Calculated columns are computed row-by-row and stored in the data model. Use them when you need a value that is fixed for each row — like a full name combining first and last name fields, or a profit margin percentage per transaction.

Measures are calculated dynamically based on the current filter context (which page, visuals, slicers, and filters are active). Use measures for aggregations like totals, averages, percentages, and comparisons. Measures are the recommended approach in most Power BI scenarios because they are more efficient and flexible.


Understanding Filter Context

The most important concept in DAX is filter context — the set of filters applied to your data at any given moment. When you drag a measure into a visual, Power BI passes the current filter context to your DAX formula, and the formula evaluates only the rows that match those filters.

For example, if you have a bar chart showing Total Sales by Region, DAX evaluates your [Total Sales] measure separately for each region, applying a filter for that region each time. Understanding this makes DAX much easier to write correctly.


Watch: Power BI DAX Tutorial

Guy in a Cube is one of the best Power BI YouTube channels, run by Microsoft Most Valuable Professional (MVP) Patrick LeBlanc. Their channel covers DAX, data modeling, and Power BI reporting with weekly tutorials0

📺 Guy in a Cube – Power BI & DAX Tutorials (YouTube)

For structured DAX learning, Microsoft Learn also provides free official training paths:

📚 Use DAX in Power BI – Microsoft Learn


Common DAX Mistakes to Avoid

  • Using SUM in a calculated column instead of a measure – SUM in a calculated column sums all rows, ignoring the filter context. Use measures instead.
  • Forgetting to create a date table – Time intelligence functions like TOTALYTD require a properly marked date table.
  • Not understanding CALCULATE – Jumping into complex DAX without understanding CALCULATE leads to incorrect results. Master CALCULATE first.
  • Writing measures that reference other measures incorrectly – Make sure to always use square bracket notation [MeasureName] when referencing measures.

Real-World DAX Use Cases

  • Sales dashboards – Year-over-year growth, target vs. actual, running totals
  • Financial reporting – P&L comparisons, budget variance analysis
  • HR analytics – Headcount trends, attrition rates, average tenure
  • Retail analytics – Basket size, product performance, regional comparisons
  • Marketing KPIs – Conversion rates, cost per acquisition, campaign ROI

Learn Power BI at IACT

Ready to master Power BI and DAX? IACT offers hands-on Power BI training courses for all skill levels. Our trainers are certified Microsoft professionals who will guide you through data modeling, DAX calculations, dashboard design, and data visualization best practices.

👉 View IACT Power BI Courses


Further Reading

0
YOUR CART
  • No products in the cart.