DAX Nested Functions & Return Types Guide
This guide explains why many DAX functions cannot be used alone and how they are combined with other functions
in real Power BI calculations.
Logical Functions
AND(), OR(), and NOT() return TRUE/FALSE values and are usually used inside IF(), FILTER(), or CALCULATE().
High Profit Sales =
IF(
AND(Sales[Amount] > 1000, Sales[Profit] > 100),
"Good",
"Bad"
)
FILTER()
FILTER() returns a table, not a final value. It is usually wrapped by CALCULATE(), COUNTROWS(), or SUMX().
High Sales =
CALCULATE(
SUM(Sales[Amount]),
FILTER(Sales, Sales[Amount] > 1000)
)
ALL()
ALL() removes filters and is commonly used inside CALCULATE().
Total Sales Ignore Filters =
CALCULATE(
SUM(Sales[Amount]),
ALL(Sales)
)
VALUES()
VALUES() returns a unique list table and is often wrapped with COUNTROWS() or CONCATENATEX().
Unique Cities =
COUNTROWS(
VALUES(Customer[City])
)
DATESYTD()
DATESYTD() returns a date table used with CALCULATE().
YTD Sales =
CALCULATE(
SUM(Sales[Amount]),
DATESYTD(Date[Date])
)
SUMX()
Iterator functions require both a table and an expression.
Total Revenue =
SUMX(
Sales,
Sales[Quantity] * Sales[Price]
)
DAX Return Types
Return Type Examples
Scalar Value SUM, MAX, DIVIDE
Logical Value AND, OR, NOT
Table FILTER, VALUES, DATESYTD, ALL
The fastest way to improve at DAX is to stop memorizing formulas blindly and instead understand: 1. What each
function returns. 2. Which functions can accept that return type. Once you think in return types and context, DAX
becomes much easier to reason about.