DAX Basics: Your First Measures
DAX stands for Data Analysis Expressions — it's the formula language used in Power BI to create calculations. It looks a bit like Excel, but it works differently in some important ways. This guide explains the essentials clearly, so you can start writing your own measures with confidence.
What is DAX?
DAX is the language you use to create custom calculations in Power BI. While you can build a lot with the built-in aggregations (Sum, Count, Average), DAX lets you go further — calculating things like year-on-year growth, running totals, percentage of total, and much more.
DAX was designed specifically for working with tables of data and understanding relationships between them. It's used in Power BI, Power Pivot in Excel, and Analysis Services — so learning it is a skill that transfers across tools.
If you've used Excel formulas, DAX will feel familiar in some ways. Functions like SUM, AVERAGE, IF, and COUNTROWS work similarly. The key difference is that DAX is designed to work across entire tables and relationships, not just individual cells.
Don't try to learn all of DAX at once. Start with a handful of functions — SUM, CALCULATE, DIVIDE, and COUNTROWS — and you'll be able to handle the majority of real-world reporting needs.
Calculated Columns vs Measures
There are two main ways to use DAX in Power BI: calculated columns and measures. Understanding the difference is one of the most important things a beginner can learn.
A calculated column adds a new column to a table. It's calculated row by row when the data is loaded, and the result is stored in the data model. Use calculated columns when you need a value that exists at the row level — for example, combining a first name and last name into a full name, or categorising a sale as 'High', 'Medium', or 'Low'.
A measure is a calculation that's evaluated dynamically based on the context of your report. It doesn't add a column to your table — instead, it calculates a result on the fly depending on what filters, slicers, and visuals are active. Measures are the heart of DAX and the right tool for almost all aggregations and KPIs.
When in doubt, use a measure rather than a calculated column. Measures are more flexible, use less memory, and respond to filters — which is almost always what you want in a report.
Your First Measure: Total Sales
The simplest measure is a SUM. To create one, go to the Data view in Power BI Desktop, select the table you want to add the measure to, and click 'New measure' in the ribbon.
Type: Total Sales = SUM(Sales[Amount]). This tells Power BI to sum all the values in the Amount column of the Sales table. When you add this measure to a visual, it will automatically respond to any filters or slicers on the page.
Try adding the measure to a card visual to show the total, then add a slicer for year or region. Watch how the measure updates automatically as you filter — that's the power of measures over calculated columns.
Always give your measures clear, descriptive names. 'Total Sales' is much better than 'Measure1'. Good naming makes your reports easier to maintain and share with others.
The Most Important Function: CALCULATE
CALCULATE is the most powerful and most used function in DAX. It evaluates a measure or expression in a modified filter context — in other words, it lets you override or add filters to change what gets calculated.
For example: Sales in 2023 = CALCULATE(SUM(Sales[Amount]), Sales[Year] = 2023). This calculates total sales, but only for the year 2023 — regardless of what other filters are applied on the report page.
CALCULATE is the key to unlocking time intelligence, comparisons, and conditional aggregations. Once you understand how it modifies filter context, a huge range of DAX patterns become accessible.
CALCULATE can feel confusing at first because of how it interacts with filter context. The best way to learn it is to experiment — write a measure, add it to a visual, and see how it behaves when you add slicers and filters.
Common Beginner Mistakes
Using a calculated column when a measure would be better. If you find yourself summing a calculated column, that's usually a sign the calculation should be a measure instead.
Forgetting to use DIVIDE instead of the division operator. If your denominator could ever be zero, DIVIDE(numerator, denominator, 0) handles it gracefully — the plain / operator will return an error.
Writing measures that reference other measures incorrectly. In DAX, you can reference a measure inside another measure — just use the measure name without a table prefix. This is one of the things that makes DAX different from Excel.
Where to Go from Here
Once you're comfortable with SUM, CALCULATE, and DIVIDE, explore time intelligence functions like SAMEPERIODLASTYEAR and TOTALYTD. These are incredibly useful for business reporting and they're not as complicated as they sound.
The DAX Guide at dax.guide is an excellent free reference — every function is documented with clear examples. Bookmark it and use it whenever you encounter a function you don't recognise.
Ready to explore more?
Browse all our guides and videos to keep building your Power BI skills.
Browse all guides