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:
SWITCH(
Document[Type],
"Invoice", [Invoice Amount],
"Credit Note", [Credit Note Amount],
BLANK()
)
To:
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.