DAX Functions for Beginners: Power BI DAX Basics with Examples
On this page
Short answer: DAX (Data Analysis Expressions) is the formula language of Power BI. Beginners should start with measures (calculations that respond to filters) rather than calculated columns, learn basic aggregations (SUM, AVERAGE, COUNTROWS, DISTINCTCOUNT), safe division with DIVIDE, iterators like SUMX, and then the most important function, CALCULATE, which changes filter context. Add time intelligence (TOTALYTD, SAMEPERIODLASTYEAR) once you have a proper date table.
Key takeaways
- Prefer measures over calculated columns for aggregations.
- CALCULATE is the heart of DAX: it evaluates an expression under modified filters.
- Understand row context vs filter context.
- Time intelligence needs a marked date table.
Measures vs calculated columns
| Measure | Calculated column | |
|---|---|---|
| Calculated | At query time, based on filters in the visual | At data refresh, row by row |
| Stored | Not stored | Stored in the model (uses memory) |
| Use for | Totals, ratios, KPIs | Categories used to slice or filter (e.g. age band) |
Essential DAX functions with examples
Basic aggregations
Total Sales = SUM ( Sales[Amount] )
Avg Order Value = AVERAGE ( Sales[Amount] )
Orders = COUNTROWS ( Sales )
Customers = DISTINCTCOUNT ( Sales[CustomerID] )
Safe division with DIVIDE
Profit Margin % = DIVIDE ( [Total Profit], [Total Sales] )
DIVIDE returns BLANK (or an alternate value) instead of an error when the denominator is zero.
Iterators: SUM vs SUMX
SUM adds a single column. SUMX evaluates an expression for every row, then adds the results:
Revenue = SUMX ( Sales, Sales[Quantity] * Sales[UnitPrice] )
CALCULATE: changing filter context
Mumbai Sales = CALCULATE ( [Total Sales], Stores[City] = "Mumbai" )
All-City Sales = CALCULATE ( [Total Sales], ALL ( Stores[City] ) )
% of All Cities = DIVIDE ( [Total Sales], [All-City Sales] )
ALL removes filters on a column or table, which is how you build “percent of total” measures.
FILTER for complex conditions
High-Value Orders =
CALCULATE (
COUNTROWS ( Sales ),
FILTER ( Sales, Sales[Amount] > 10000 )
)
For simple column conditions, a direct filter argument (as in “Mumbai Sales”) is usually simpler and faster than FILTER.
Logical functions
Sales Status = IF ( [Total Sales] >= [Target], "On track", "Behind" )
Size Band =
SWITCH (
TRUE (),
Sales[Amount] >= 10000, "Large",
Sales[Amount] >= 1000, "Medium",
"Small"
)
(Size Band is a calculated column because it works row by row.)
Variables with VAR
Sales Growth % =
VAR CurrentSales = [Total Sales]
VAR PreviousSales = CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
RETURN
DIVIDE ( CurrentSales - PreviousSales, PreviousSales )
Variables make measures easier to read and avoid repeating calculations.
Time intelligence
Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] )
Sales LY = CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
Sales MTD = TOTALMTD ( [Total Sales], 'Date'[Date] )
Requirement: a continuous date table related to your fact table and marked as a date table. For Indian financial years, use the year-end argument, e.g. TOTALYTD ( [Total Sales], 'Date'[Date], "31/3" ).
Row context vs filter context
- Filter context: the filters applied by slicers, visuals and CALCULATE
- Row context: the “current row” in a calculated column or an iterator like SUMX
- Context transition: CALCULATE turns row context into filter context, which is why a measure used inside an iterator behaves per row
Common beginner mistakes
- Using calculated columns where a measure is needed
- Dividing with “/” instead of DIVIDE
- Time intelligence without a proper date table
- Over-using FILTER on whole tables, which slows reports
- Not formatting measures (currency, percentage)
Frequently asked questions
Is DAX hard to learn?
Basic measures are easy; filter context and CALCULATE take practice. Learn them with small, real examples.
Is DAX the same as Excel formulas?
Some functions look similar, but DAX works on tables and columns with filter context, not on individual cells.
DAX vs Power Query (M)?
Use Power Query to clean and shape data before loading; use DAX for calculations and analysis in the model.
Are DAX questions asked in interviews?
Yes, especially CALCULATE, measures vs columns and time intelligence. See Power BI interview questions.
Conclusion
Start your DAX journey with measures, basic aggregations, DIVIDE and SUMX, then master CALCULATE and filter context, and finally time intelligence. With these DAX functions for beginners, you can build most business dashboards. Comparing tools? Read Power BI vs Tableau.
Learn DAX on real dashboards in our Power BI course.
Related reading
Learn with Mehul Prajapati in Borivali West
At Mehul Prajapati’s institute, you get 100% practical, hands-on training by industry experts with a minimum of 5+ years of experience, plus job-oriented programmes with placement support. Weekday and weekend batches are available, with multiple 2-hour slots between 8 am and 6 pm.
Address: 12th Floor, 1214, Gold Crest Business Centre, LT Rd, Above Westside Showroom, Borivali West, Mumbai, Maharashtra 400092
Call: +91 99301 12627 / +91 96645 45072
Visit the centre or call us to choose the right course and batch and to know the current fee structure.