DAX Logical Functions

Logical Functions in DAX

Logical functions in DAX are used to perform operations based on conditions returning different results depending on whether those conditions are TRUE or FALSE.

They’re essential for conditional calculations, custom categories, and dynamic KPIs.

Common Logical Functions in DAX

FunctionDescriptionExample
IF()Returns one value if a condition is TRUE, another if FALSEIF(Sales[Amount] > 1000, "High", "Low")
SWITCH()Tests multiple conditions and returns the first matchSee below
AND()Returns TRUE if both conditions are TRUEAND(Sales[Amount]>500, Sales[Region]="West")
OR()Returns TRUE if any condition is TRUEOR(Sales[Amount]>500, Sales[Region]="East")
NOT()Reverses a logical valueNOT(Sales[IsActive])
IFERROR()Returns a custom value if the expression results in an errorIFERROR([Measure], 0)
TRUE() / FALSE()Explicitly returns the boolean TRUE or FALSEIF(Sales[Returned] = TRUE(), "Returned", "Not Returned")
  • SWITCH() Function
Category = 
SWITCH(
    TRUE(),
    Sales[Amount] > 1000, "High",
    Sales[Amount] > 500, "Medium",
    "Low"
)

This works like a multi-condition IF, checking conditions in order and returning the first match.

Key Notes

  • Logical functions are booleans: They return TRUE or FALSE.
  • Often used in calculated columns, measures, or filters.
  • Logical conditions can be combined using AND, OR, NOT.

Real-World Use Cases

Use CaseExample
Tag high-value ordersIF(Sales[Amount] > 1000, "High", "Low")
Prevent errors in divisionIFERROR([Profit]/[Sales], 0)
Create category bandsUse SWITCH() or nested IF()s
No questions available.