Table of Contents

Code action DR012 (Readability) Remove unnecessary BLANK

Description

Some DAX functions, such as IF and SWITCH already return BLANK() when the condition is false, so there is no need to explicitly specify BLANK().

Example

Change:

DAX
SWITCH( Document[Type], "Invoice", [Invoice Amount], "Credit Note", [Credit Note Amount], BLANK() )

To:

DAX
SWITCH( Document[Type], "Invoice", [Invoice Amount], "Credit Note", [Credit Note Amount] )

Why is Tabular Editor suggesting this?

The BLANK() function is redundant when used as the last argument in an IF or SWITCH function, as these functions already return BLANK() when the condition is false. By removing the BLANK() function, the code becomes more concise and easier to read.