Reputation: 37
M-CY_Growth% = calculate([M-CY_Growth]/abs([M-PY_Sales]))
Is equal to use or not CALCULATE?
Upvotes: 0
Views: 42
Reputation: 11
As far as I'm aware, unless you pass a "filter" argument, there is no difference in passing an expression to the CALCULATE function, and evaluating that expression outside of the CALCULATE function. In this case, because you are not passing a filter argument to the CALCULATE function, there is no reason to use it.
CALCULATE is designed so that you have some control over the context in which an expression is evaluated. You can do this by passing a filter to the CALCULATE function that would otherwise have not been considered during expression evaluation. Conversely, you can use the CALCULATE function to ignore filters that would have otherwise been taken into consideration during the evaluation of the expression.
The Microsoft Docs article for the function provides more information, as well as an example of the latter scenario mentioned above: https://learn.microsoft.com/en-us/dax/calculate-function-dax.
Upvotes: 0
Reputation: 40204
Assuming [M-CY_Growth]
and [M-PY_Sales]
are measures, there should not be a difference.
From The Definitive Guide to DAX Chapter 5, Understanding context transition with measures section:
whenever you invoke a measure from inside another expression, DAX automatically encapsulates the measure inside CALCULATE.
Upvotes: 1
Reputation: 1362
There should be no difference. In fact in most cases when a measure is called it is implicitly wrapped in calculate.
Upvotes: 0