Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
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 cannot find an answer to. The formula would be something like this (with a and b being measures that are already defined elsewhere):
c:= IF(a && b; DIVIDE(a; b) - 1; BLANK())
Should I define a and b as variables within c?
Or are a and b considered as constant values within c after the first calculation which would make the measure reference more efficent?
Thank you
Justus
Solved! Go to Solution.
@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)
@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)
@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.
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.
@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)
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 32 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 66 | |
| 58 | |
| 31 | |
| 25 | |
| 24 |