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 guys,
can anyone explain why the first DAX formula gives a correct result:
AVERAGE =
CALCULATE(AVERAGE('Tab 3'[Measure]);
CALCULATETABLE(
TREATAS(VALUES('Tab 2'[K_TWO]);'Tab 3'[K_TWO])
;
TREATAS(CALCULATETABLE(VALUES('Tab 1'[K_ONE]);'Tab 1'[Type]=0);'Tab 2'[K_ONE])
))
while the second one, with variables:
AVERAGE (VAR) =
VAR T1 = TREATAS(VALUES('Tab 2'[K_TWO]);'Tab 3'[K_TWO])
VAR T2 = TREATAS(CALCULATETABLE(VALUES('Tab 1'[K_ONE]);'Tab 1'[Type]=0);'Tab 2'[K_ONE])
RETURN
CALCULATE(AVERAGE('Tab 3'[Measure]);
CALCULATETABLE(T1;T2))
does not?
Thanks!
@Anonymous ,
Could you please share some sample data and clarify more details?
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 33 | |
| 29 | |
| 24 |
| User | Count |
|---|---|
| 126 | |
| 115 | |
| 85 | |
| 69 | |
| 69 |