Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hello, I'm trying to understand why the following is failing in DAX studio (prob can do it in PowerBI, but I'm trying to learn DAX studio for more complex expressions). What is causing issues is when / how to use combination of variables and tables.
Example 1
DEFINE VAR x = .... (expression with table result)
EVALUTE X
This example works just fine even though x is a define as variable and not table. Is it safe to assume EVALUTE will automatically recognize that?
Example 2
DEFINE VAR x = ...(expression with table result)
VAR t = FILTER(x....)
This example fails because "FILTER expects a table"..... Do I have to execute a return statement, do I need to instead define X as a TABLE vs VAR?
I know return "evaluates" and returns variable values but I'm not understanding how that is used in DAX studio vs PowerBI.
I can't seem to find any good docs / examples on how to combine these concepts, any help would be appreciated.
A variable can hold either a table or a scalar value, e.g.
DEFINE
VAR Numbers = GENERATESERIES( 1, 20, 1 )
VAR LowNumbers = FILTER( Numbers, [Value] < 5 )
EVALUATE
LowNumbers
works fine.
EVALUATE requires a table expression so if you can run EVALUATE x then x is definitely a table, and you can use it as a parameter to any functions that accept a table expression.
In DAX Studio you will mostly use EVALUATE rather than RETURN. EVALUATE executes a query whereas RETURN is mostly used in the definition of measures and calculated columns or tables. You might find the video at https://dax.guide/st/return/ helpful
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |