In short: DAX functions have English names in every language version of Power BI, arguments are separated by commas and decimals use a point. Columns are written as Table[Column], measures as [Measure].
All examples use a small sales model with the tables Sales, Product, Region and Date and the measure [Total Sales]. You can try each of them in the DAX playground: there you write measures as DEFINE MEASURE Sales[Name] = … in front of a query. We compared the results of all examples with Power BI Desktop.
Jump to: Aggregation, Iterators (row by row), Filter and context, Relationships, Logical and information, Math, Text, Date and time, Time intelligence, Tables and queries
Explained in detail: COUNTIF in DAX, DATEDIFF and the semantic model all measures calculate in.
Aggregation
| Function | What for | Example | Lesson |
|---|
SUM | Sum of a column | Total Sales = SUM(Sales[Amount]) | Measures: SUM, COUNTROWS, DISTINCTCOUNT |
AVERAGE | Average of a column | Avg Amount = AVERAGE(Sales[Amount]) | Measures: SUM, COUNTROWS, DISTINCTCOUNT |
MIN, MAX | Smallest or largest value | Last Order = MAX(Sales[OrderDate]) | Measures: SUM, COUNTROWS, DISTINCTCOUNT |
MEDIAN | Middle value | Median Amount = MEDIAN(Sales[Amount]) | |
COUNTROWS | Count the rows of a table | Orders = COUNTROWS(Sales) | Measures: SUM, COUNTROWS, DISTINCTCOUNT |
COUNT, COUNTA, COUNTBLANK | Count values, non-blank values or blank values in a column | No Ship Date = COUNTBLANK(Sales[ShipDate]) | |
DISTINCTCOUNT | Count distinct values | Products Sold = DISTINCTCOUNT(Sales[ProductID]) | Measures: SUM, COUNTROWS, DISTINCTCOUNT |
DIVIDE | Divide, blank instead of an error when dividing by zero | Avg Order Value = DIVIDE([Total Sales], COUNTROWS(Sales)) | Dividing with DIVIDE |
Iterators (row by row)
| Function | What for | Example | Lesson |
|---|
SUMX | Evaluate an expression per row and add up | Sales from Quantity = SUMX(Sales, Sales[Quantity] * RELATED(Product[Price])) | SUMX and iterators |
AVERAGEX | Average of an expression per row | Avg Sales per Region = AVERAGEX(VALUES(Region[Region]), [Total Sales]) | SUMX and iterators |
MINX, MAXX | Smallest or largest value of an expression per row | Best Month = MAXX(VALUES('Date'[Month]), [Total Sales]) | SUMX and iterators |
COUNTX | Count rows where the expression is not blank | Regions with Sales = COUNTX(VALUES(Region[Region]), [Total Sales]) | |
CONCATENATEX | Join texts per row into one text | Categories = CONCATENATEX(VALUES(Product[Category]), Product[Category], ", ") | |
RANKX | Rank of a value in a list | Region Rank = RANKX(ALL(Region[Region]), [Total Sales]) | RANKX and TOPN |
Filter and context
| Function | What for | Example | Lesson |
|---|
CALCULATE | Evaluate a measure with a changed filter | Sales North = CALCULATE([Total Sales], Region[Region] = "North") | CALCULATE |
FILTER | Keep the rows of a table where the condition is true | Large Orders = COUNTROWS(FILTER(Sales, Sales[Amount] > 500)) | SUMX and iterators |
ALL | Remove filters from a table or column | Share = DIVIDE([Total Sales], CALCULATE([Total Sales], ALL(Region))) | Percent of total with ALL |
REMOVEFILTERS | Like ALL, but only as a filter in CALCULATE | Sales All Years = CALCULATE([Total Sales], REMOVEFILTERS('Date')) | Percent of total with ALL |
ALLEXCEPT | Remove all filters of a table except on certain columns | Category Sales = CALCULATE([Total Sales], ALLEXCEPT(Product, Product[Category])) | |
ALLSELECTED | Remove the row filters, keep the slicers | Visible Share = DIVIDE([Total Sales], CALCULATE([Total Sales], ALLSELECTED(Region))) | Percent of total with ALL |
KEEPFILTERS | Add a filter in CALCULATE instead of replacing | Hardware Here = CALCULATE([Total Sales], KEEPFILTERS(Product[Category] = "Hardware")) | CALCULATE |
VALUES, DISTINCT | Distinct values of a column in the current filter | Regions = COUNTROWS(VALUES(Region[Region])) | Filter context |
SELECTEDVALUE | The single value of a column, otherwise an alternate | Title = "Sales " & SELECTEDVALUE(Region[Region], "all regions") | Filter context |
HASONEVALUE | True when exactly one value is in the filter | Per Region Only = IF(HASONEVALUE(Region[Region]), [Total Sales]) | Filter context |
ISFILTERED, ISINSCOPE | Whether a column is filtered or a row field of the matrix | Level = IF(ISINSCOPE(Product[Product]), "Product", "Category") | Hierarchy and drill down |
TOPN | The first N rows by a value | Top 3 Products = CALCULATE([Total Sales], TOPN(3, ALL(Product), [Total Sales])) | RANKX and TOPN |
Relationships
| Function | What for | Example | Lesson |
|---|
RELATED | Fetch a value from the one side of a relationship | Category = RELATED(Product[Category]) | Calculated columns |
RELATEDTABLE | Related rows on the many side | Orders per Product = COUNTROWS(RELATEDTABLE(Sales)) | LOOKUPVALUE and RELATEDTABLE |
USERELATIONSHIP | Turn on an inactive relationship in CALCULATE | Sales by Ship Date = CALCULATE([Total Sales], USERELATIONSHIP(Sales[ShipDate], 'Date'[Date])) | Cardinality and cross filter direction |
LOOKUPVALUE | Look up a value by a condition, even without a relationship | Laptop Price = LOOKUPVALUE(Product[Price], Product[Product], "Laptop") | LOOKUPVALUE and RELATEDTABLE |
TREATAS | Apply the values of a table as a filter on another column | Sales North South = CALCULATE([Total Sales], TREATAS({"North", "South"}, Region[Region])) | |
Logical and information
| Function | What for | Example | Lesson |
|---|
IF | One condition, two results | Target Met = IF([Total Sales] > 10000, "yes", "no") | IF and SWITCH |
SWITCH | Several cases; with TRUE() several conditions | Class = SWITCH(TRUE(), [Total Sales] > 20000, "A", [Total Sales] > 10000, "B", "C") | IF and SWITCH |
AND, OR, NOT, &&, ||, IN | Combine conditions | Hardware North East = CALCULATE([Total Sales], Product[Category] = "Hardware", Region[Region] IN {"North", "East"}) | IF and SWITCH |
BLANK, ISBLANK | Blank value and the test for it | Sales or 0 = IF(ISBLANK([Total Sales]), 0, [Total Sales]) | IF and SWITCH |
COALESCE | First non-blank value | Sales with 0 = COALESCE([Total Sales], 0) | |
IFERROR | Alternate value on an error | Safe = IFERROR(1 / COUNTROWS(Sales), 0) | |
Math
| Function | What for | Example | Lesson |
|---|
ROUND, ROUNDUP, ROUNDDOWN | Round, round up, round down | Sales Rounded = ROUND([Total Sales], -2) | |
INT, TRUNC, MOD | Integer part, remainder of a division | Remainder = MOD(COUNTROWS(Sales), 7) | |
ABS, SIGN, POWER, SQRT | Absolute value, sign, power, square root | Distance = ABS([Total Sales] - 20000) | |
Text
| Function | What for | Example | Lesson |
|---|
&, CONCATENATE | Join texts | Label = "Sales: " & FORMAT([Total Sales], "#,0") | Creating a dashboard |
FORMAT | A number or date as text with a format | Month = FORMAT(MAX('Date'[Date]), "MMMM yyyy") | Creating a dashboard |
LEFT, RIGHT, MID, LEN | Parts of a text, length | Code = LEFT(SELECTEDVALUE(Region[Region], "All"), 1) | |
UPPER, LOWER, TRIM | Upper case, lower case, remove spaces | Region Upper = UPPER(SELECTEDVALUE(Region[Region])) | |
SEARCH, FIND, SUBSTITUTE, CONTAINSSTRING | Find, replace, contains text | With "top" = CALCULATE([Total Sales], CONTAINSSTRING(Product[Product], "top")) | |
Date and time
| Function | What for | Example | Lesson |
|---|
DATE, YEAR, MONTH, DAY | Build or split a date | Sales from July = CALCULATE([Total Sales], 'Date'[Date] >= DATE(2026, 7, 1)) | Date table |
WEEKDAY, WEEKNUM, QUARTER | Day of week, week number, quarter | Weekend = CALCULATE([Total Sales], WEEKDAY('Date'[Date], 2) > 5) | |
EOMONTH, EDATE | End of month, date months later | Month End = EOMONTH(MAX(Sales[OrderDate]), 0) | |
DATEDIFF | Distance between two dates in days, months, years | Avg Ship Days = AVERAGEX(Sales, DATEDIFF(Sales[OrderDate], Sales[ShipDate], DAY)) | Calculated columns |
CALENDAR, CALENDARAUTO | Create a date table | Date = CALENDAR(DATE(2025, 1, 1), DATE(2026, 12, 31)) | Date table |
TODAY, NOW | Today, now | Days Since Last Order = DATEDIFF(MAX(Sales[OrderDate]), TODAY(), DAY) | |
Time intelligence
| Function | What for | Example | Lesson |
|---|
TOTALYTD, TOTALMTD, TOTALQTD | Year-, month- or quarter-to-date total | Sales YTD = TOTALYTD([Total Sales], 'Date'[Date]) | Time intelligence |
DATESYTD, DATESMTD, DATESQTD | Dates from the start of the year, month or quarter | Sales YTD = CALCULATE([Total Sales], DATESYTD('Date'[Date])) | Time intelligence |
SAMEPERIODLASTYEAR | The same period last year | Sales PY = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date])) | Time intelligence |
DATEADD | Shift a period by days, months, quarters or years | Sales PM = CALCULATE([Total Sales], DATEADD('Date'[Date], -1, MONTH)) | Time intelligence |
PREVIOUSMONTH, PREVIOUSYEAR, NEXTMONTH | Whole previous month, previous year or next month | Sales Whole PM = CALCULATE([Total Sales], PREVIOUSMONTH('Date'[Date])) | |
PARALLELPERIOD | Whole period shifted | Sales Whole PY = CALCULATE([Total Sales], PARALLELPERIOD('Date'[Date], -1, YEAR)) | |
DATESINPERIOD, DATESBETWEEN | Date range for rolling periods | Sales 3 Months = CALCULATE([Total Sales], DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, MONTH)) | |
Tables and queries
| Function | What for | Example | Lesson |
|---|
EVALUATE | Run a DAX query; the result is a table | EVALUATE TOPN(5, Product, Product[Price], DESC) | DAX queries |
DEFINE MEASURE, VAR | Measures and variables for a query | DEFINE MEASURE Sales[Count] = COUNTROWS(Sales) EVALUATE ROW("Count", [Count]) | DAX queries |
SUMMARIZECOLUMNS | Group with measures, like a matrix | EVALUATE SUMMARIZECOLUMNS(Region[Region], "Sales", [Total Sales]) | DAX queries |
ADDCOLUMNS, SELECTCOLUMNS | Add or select columns | EVALUATE ADDCOLUMNS(VALUES(Region[Region]), "Sales", [Total Sales]) | DAX queries |
SUMMARIZE | Distinct combinations of columns | EVALUATE SUMMARIZE(Sales, Product[Category], Region[Region]) | |
ROW, DATATABLE, {…} | Small table right in the expression | EVALUATE ROW("Orders", COUNTROWS(Sales), "Sales", [Total Sales]) | DAX queries |
UNION, INTERSECT, EXCEPT, CROSSJOIN | Stack tables, intersection, difference, every combination | EVALUATE EXCEPT(VALUES(Region[Region]), {"North"}) | |
GENERATESERIES | A series of numbers as a table | EVALUATE GENERATESERIES(1, 5) | |
Rules that always apply
- Measure or column: a measure recalculates in the filter of every cell, a calculated column once per row when the data loads. The lesson on measures explains when to use which.
- Row context: in a calculated column and in iterators such as SUMX there is a current row;
Table[Column] returns the value of that row there. In a measure without an iterator every column needs an aggregation such as SUM.
- CALCULATE replaces filters: a condition on a column replaces the filter on that column, other filters stay. With KEEPFILTERS it is added instead. More in the lesson on CALCULATE.
- Blank is not zero: BLANK disappears in sums, DIVIDE returns BLANK when the denominator is zero, and in a comparison BLANK counts as 0 or as empty text, so it is smaller than any date.
- Reserved names: if a table has the name of a DAX word, such as Date, put it in single quotes:
'Date'[Year].
- TODAY in the exercises: in exercises and the playground TODAY always returns 20 Nov 2026, so that results stay the same. In Power BI it is the real current date.
How to learn DAX
A list does not replace practice. In the Power BI course you write each of these functions yourself, and the server checks your measure on visible and on hidden numbers. That shows whether it is also right in another row, another year or with other data.