Daily DAX : Day 312 BLANK
Power BI DAX BLANK Function
Description
The BLANK
function in DAX (Data Analysis Expressions) returns a blank value. A blank in DAX represents a null or empty value, often used to handle missing or undefined data in calculations or visuals in Power BI.
Syntax
BLANK()
Parameters: None. The function takes no arguments.
Return Value
A blank value (null or empty).
Use Cases
- Handling Missing Data: Use
BLANK
to represent missing or undefined values in calculations, ensuring consistent behavior in measures or calculated columns. - Conditional Logic: Combine with functions like
IF
orISBLANK
to manage scenarios where data is absent. - Data Visualization: Prevent errors in visuals by returning
BLANK
instead of invalid results (e.g., divide-by-zero errors). - Default Values: Use in measures to provide a default blank value when conditions are not met.
Example
Suppose you want to calculate a ratio but avoid division by zero. You can use BLANK
to return a blank value when the denominator is zero.
SafeRatio =
IF(
Table[Denominator] = 0,
BLANK(),
Table[Numerator] / Table[Denominator]
)
Explanation: If Table[Denominator]
is 0, the measure returns a blank value instead of an error. Otherwise, it calculates the ratio.
Notes
BLANK
is different from 0 or an empty string ("").- Use
ISBLANK
to test for blank values in conditions. - Blanks are ignored in aggregations like
SUM
orAVERAGE
, which can affect calculations.
Comments
Post a Comment