Day 13: Logical, Information, and Filter Functions in Power BI DAX
On Day 13, we explore logical functions, information functions, and filter functions in DAX. These functions allow you to perform conditional calculations, validate data, and apply advanced filtering for precise analysis.
1. Logical Functions
Logical functions help you implement conditional logic in DAX formulas.
-
SWITCH() – Evaluates an expression against multiple values and returns a result based on the first match.
-
IF() – Performs an IF-ELSE condition.
-
AND() – Checks if multiple conditions are true simultaneously.
-
OR() – Checks if at least one condition is true.
-
TRUE/FALSE() – Returns a Boolean value.
Example:
This categorizes sales as “High” or “Low” based on a threshold.
2. Information Functions
Information functions validate or inspect data types and content:
-
ISEVEN() – Checks if a number is even.
-
ISODD() – Checks if a number is odd.
-
ISBLANK() – Checks if a value is blank.
-
ISNUMBER() – Checks if a value is numeric.
-
ISTEXT() – Checks if a value is text.
-
ISNONBLANK() – Checks if a value is not blank.
-
ISNONTEXT() – Checks if a value is not text.
-
ISLOGICAL() – Checks if a value is Boolean.
-
ISFILTERED() – Checks if a column or table is filtered.
-
ISNULL() – Checks if a value is null.
These functions are useful for data validation, error handling, and conditional calculations.
3. Filter Functions
Filter functions allow you to control context and filter tables in DAX calculations. Key functions include:
-
CALCULATE() – Evaluates an expression in a modified filter context and returns a scalar value.
-
Single filter:
-
Multiple filters:
-
Using AND:
-
Using OR:
-
-
Commenting in CALCULATE:
-
CALCULATETABLE() – Creates a new table based on an existing table with applied filters.
-
Example:
-
With multiple filters:
-
Summary
-
Logical functions allow conditional evaluation.
-
Information functions validate and inspect data.
-
Filter functions like
CALCULATEandCALCULATETABLEcontrol the context for precise calculations and table creation.
Mastering these DAX functions is essential for dynamic, context-aware reporting in Power BI.