Code action DR010
(Readability) Rewrite using COALESCE
Description
Instead of using IF
to return the first non-blank value from a list of expressions, use the COALESCE
function.
Example
Change:
IF(
ISBLANK(Product[Long Description]),
Product[Short Description],
Product[Long Description]
)
To:
COALESCE(Product[Long Description], Product[Short Description])
Why is Tabular Editor suggesting this?
The COALESCE
function is a more concise and easier to read way of returning the first non-blank value from a list of expressions. By using COALESCE
, the code becomes more readable and the intent of the expression is clearer.