Forum Discussion
Jayshamone
5 years agoHelper I
DAX Measure Reference Performance
Hello, I understand that using variables much more efficient than definining calculations multiple times within one measure. Calculating a ratio however, creates another performance question, I ...
- 5 years ago
Jayshamone , something like this should be better
Measure =
Var _a =a
Var _b = b
return
if(isblank(_a) ||isblank(_b) ,DIVIDE(a-b; b) , blank)
Greg_Deckler
5 years agoCommunity Champion
Jayshamone VAR's are constants, they cannot be recalculated. So yes, you should define a and b as VAR's and use those var's in your final calculation.
Jayshamone
5 years agoHelper I
Thank you, Greg_Deckler for your quick response.
So a and b would indeed be recalcualted in c?
This would mean that if I make a change to a, I would need to make the same change to var a in c making it harder to maintain.
- Greg_Deckler5 years agoCommunity Champion
Jayshamone I'm not sure what you are saying by recalculate. VAR's do not recalculate:
Measure = VAR __a = [a] VAR __b = [b] RETURN IF(ISBLANK(__a) || ISBLANK(__b),BLANK(),DIVIDE(__a, __b,BLANK()) - 1)