Table of Contents

Code action DI009 (Improvement) Avoid calculate shortcut syntax

Description

Do not use the calculate shortcut syntax.

Example

Change:

[Total Sales](Products[Color] = "Red")

To:

CALCULATE([Total Sales], Products[Color] = "Red")

Why is Tabular Editor suggesting this?

The calculate shortcut syntax is a shorthand for the CALCULATE function, where the first argument is the measure to evaluate, and the second argument is the filter expression. While this syntax is valid, it is not recommended, as it can be confusing to read and understand. It is better to use the CALCULATE function explicitly, as it makes the code more readable and maintainable.