KB 100900
Blank comparison
BLANK is used for comparison in a binary operator where the operator is not strict equal to (==).
Remarks
When the BLANK function is used as an operand in a binary comparison operation, the engine performs a transformation to compare the computed value with both 0 and BLANK, which has a small CPU cost. Moreover, a comparison with BLANK is often incorrect as 0 or an empty string (“”) returns TRUE if compared with = to BLANK.
Example 1
Replace the = operator with == or use ISBLANK to get the right behavior and better performance.
Original code
CALCULATE (
[Sales Amount],
Product[Brand] = BLANK()
)
Possible optimization 1
CALCULATE (
[Sales Amount],
Product[Brand] == BLANK()
)
Possible optimization 2
CALCULATE (
[Sales Amount],
ISBLANK ( Product[Brand] )
)
Example 2
Remove the <> operator and use NOT ISBLANK to get the right behavior and better performance.
Original code
CALCULATE (
[Sales Amount],
Product[Brand] <> BLANK()
)
Possible optimization
CALCULATE (
[Sales Amount],
NOT ISBLANK ( Product[Brand] )
)