Forum Discussion
DAX Formula Optimization - Using Calculate vs. another measure
- Anonymous8 years ago
I would expect that in your example, your calculate statement should be faster. This is because it only needs to make considerations on the table once.
How much more optimal? How long is a peice of string? It really comes down to the size of your data and what relies on these measures. Is your table 1 million rows and is your visuals going to be calling this figure 100s of times?
To further the optimisation discussion, you can also make use of Variables to increase the efficency of a measure. Consider this:
Fail % = DIVIDE( [No Of Fails], [No Of Fails] + [No Of Success] )Compared to:
Fail % = Var Fails = [No Of Fails] RETURN DIVIDE( Fails, Fails + [No Of Success] )
I would expect that in your example, your calculate statement should be faster. This is because it only needs to make considerations on the table once.
How much more optimal? How long is a peice of string? It really comes down to the size of your data and what relies on these measures. Is your table 1 million rows and is your visuals going to be calling this figure 100s of times?
To further the optimisation discussion, you can also make use of Variables to increase the efficency of a measure. Consider this:
Fail % = DIVIDE(
[No Of Fails],
[No Of Fails] + [No Of Success]
)
Compared to:
Fail % = Var Fails = [No Of Fails]
RETURN
DIVIDE(
Fails,
Fails + [No Of Success]
)