Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have a complex DAX statment to calculate a column (yes, I know, don't get me started).
It works.
It has several calculations, all organised nicely using VAR statements.
The issue is as follows:
I want the code to return a specific value if a certain condition is met in the 1st go, and then not run through the extra caculations.
So, instead of:
0.1 My Col =
_VAR _V1 = calc
_VAR _V2 = calc
_VAR _V3 = calc
VAR _RET = IF (Table[column], 8, _v1 + v2 +v3)
RETURN _RETWhich means I would run all 3 calcs,
I want to write something like:
0.1 My Col =
IF (Table[column],
RETURN 8,
_VAR _V1 = calc
_VAR _V2 = calc
_VAR _V3 = calc
RETURN _v1 + v2 +v3
)I don't get it to work.
Is it even possible? Thanks!
Solved! Go to Solution.
Hi @Hila_DG_TMX
This should be the correct syntax:
0.1 My Col =
IF (
Table[column],
8,
VAR _V1 = calc
VAR _V2 = calc
VAR _V3 = calc
RETURN
_V1 + _V2 + _V3
)
The three variables should only be evaluated when the condition within IF is false.
Does this work as expected for you?
Hi @Hila_DG_TMX
This should be the correct syntax:
0.1 My Col =
IF (
Table[column],
8,
VAR _V1 = calc
VAR _V2 = calc
VAR _V3 = calc
RETURN
_V1 + _V2 + _V3
)
The three variables should only be evaluated when the condition within IF is false.
Does this work as expected for you?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 13 | |
| 8 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 29 | |
| 18 | |
| 17 | |
| 11 | |
| 10 |