DAX Logical Functions

Last Updated: 03 Sep, 2026

What Are Logical Functions in DAX?

Logical functions in DAX — IF(), AND(), OR(), and SWITCH() — return values based on conditions, letting a measure or calculated column change its result depending on whether a test is true or false.

Common DAX Logical Functions

  • IF(): returns one value if a condition is true and another if it’s false.
  • AND(): returns true only if both supplied conditions are true.
  • OR(): returns true if at least one of the supplied conditions is true.
  • SWITCH(): evaluates an expression against a list of possible values and returns the matching result, similar to a multi-branch IF.

When to Use SWITCH Instead of Nested IF

Nesting several IF() functions inside each other quickly becomes hard to read and debug. SWITCH() flattens the same logic into a single, linear list of conditions and results, which is generally easier to maintain once there are more than two or three branches.

How to Use IF and SWITCH in a DAX Measure

This tutorial builds a conditional DAX measure two ways — first with IF(), then rewritten with SWITCH() — in about 5 steps, so you can see when each is the better fit.

Prerequisites

  • Power BI Desktop with a table containing a category-style column
  • A basic measure already in place

Steps

  • Write a simple IF() measure: Sales Flag = IF([Total Sales] > 10000, “High”, “Low”).
  • Add a second condition with AND(): IF(AND([Total Sales] > 10000, Sales[Region] = “West”), “High West”, “Other”).
  • Rewrite the same logic with SWITCH(): SWITCH(TRUE(), [Total Sales] > 10000, “High”, [Total Sales] > 5000, “Medium”, “Low”).
  • Compare readability: Notice how SWITCH(TRUE(), …) reads as a flat list of conditions rather than nested parentheses.
  • Test both versions: Add each measure to a table visual and confirm they return matching results.