This reference lists 11 DAX logical functions, with frequently used functions marked 🔥. Each function includes syntax, an example and parameter notes.
| Function | Description | Syntax | Example |
|---|---|---|---|
AND 🔥 |
Checks whether all arguments are TRUE | AND(<logical1>, <logical2>) |
AND(Sales[Amount] > 1000, Sales[Quantity] > 5) |
CHOOSE 🔥 |
Returns the value at the given position in a list | CHOOSE(<index>, <value1>, [<value2>]) |
CHOOSE(2, "Red", "Green", "Blue") |
IF 🔥 |
Checks a condition and returns one value if TRUE, another if FALSE | IF(<logical_test>, <value_if_true>, [<value_if_false>]) |
IF(Sales[Amount] > 1000, "High", "Low") |
IFERROR 🔥 |
Returns a specified value if the expression errors; otherwise returns the expression result | IFERROR(<value>, <value_if_error>) |
IFERROR(Sales[Amount] / Sales[Quantity], 0) |
OR 🔥 |
Checks whether any argument is TRUE | OR(<logical1>, <logical2>) |
OR(Sales[Amount] > 1000, Sales[Quantity] > 10) |
SWITCH 🔥 |
Evaluates an expression against a list of values and returns the first matching result | SWITCH(<expression>, <value>, <result>, [<value>, <result>], [<else>]) |
SWITCH(Sales[Region], "North", 1000, "South", 2000, 0) |
COALESCE |
Returns the first non-blank value | COALESCE(<value1>, <value2>) |
COALESCE(BLANK(), "Default") |
FALSE |
Returns the logical value FALSE | FALSE() |
FALSE() |
IFNA |
Returns a specified value if the expression result is #N/A | IFNA(<value>, <value_if_na>) |
IFNA(LOOKUPVALUE(Products[Name], Products[ID], Sales[ProductID]), "Not Found") |
NOT |
Reverses a logical value | NOT(<logical>) |
NOT(Sales[Amount] > 1000) |
TRUE |
Returns the logical value TRUE | TRUE() |
IF(Sales[Amount] > 1000, TRUE(), FALSE()) |
Detailed parameters for frequently used functions
AND
Checks whether all arguments are TRUE.
| Parameter | Description |
|---|---|
logical1 |
The first condition to test. |
logical2 |
The second condition to test. More conditions can be added. |
CHOOSE
Returns the value at the given position in a list.
| Parameter | Description |
|---|---|
index |
The position to select (1-based). |
value1 |
The first value. |
value2... |
(Optional) More values. |
IF
Checks a condition and returns one value if TRUE, another if FALSE.
| Parameter | Description |
|---|---|
logical_test |
The condition to test, returning TRUE or FALSE. |
value_if_true |
The value to return when the condition is TRUE. |
value_if_false |
(Optional) The value to return when the condition is FALSE. Defaults to BLANK. |
IFERROR
Returns a specified value if the expression errors; otherwise returns the expression result.
| Parameter | Description |
|---|---|
value |
The expression to check. |
value_if_error |
The value to return when the expression errors. |
OR
Checks whether any argument is TRUE.
| Parameter | Description |
|---|---|
logical1 |
The first condition to test. |
logical2 |
The second condition to test. More conditions can be added. |
SWITCH
Evaluates an expression against a list of values and returns the first matching result.
| Parameter | Description |
|---|---|
expression |
The expression to evaluate. |
value, result |
Value-and-result pairs. There can be multiple pairs. |
else |
(Optional) The result when no value matches. |
From Online Toolbox (www.vba.net)