Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
sandeepsingh
Frequent Visitor

Does ALL function accept table variable?

HI,

 

I tried to create a table in dax using the below code, I am getting a error message : 'The ALL function expects a table reference for argument '1', but a table expression was used.' Am I missing something here.

 

Table  =
Var MyTable = ALL(Sales)
Return
ALL(mytable)

 

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

Technically, there is no context that would filter the table so all you need is:

 

Table = 'Sales'

 

It's automatically "all" because there is no filter or row context.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
AntrikshSharma
Community Champion
Community Champion

Nope, you are not allowed to use table expressions. but since you have assigned the table to the variable you don't need to use ALL again.

Table  =
Var MyTable = ALL(Sales)
Return
   MyTable

 

Honestly, I am building a complex dax query, wherein I am creating a table using summarize and add columns, I have stored the resultant table in a variable. But when I using the stored table variable again, I m getting the table expression error. ALL does not accept table variable, and what does actually is difference between table expression and a table reference.

I think that is because variables are static and when you store a value/table in a variable it is stored once it is evaluated and post that you can not change its contents,

I found the solution in the DAX documentation - 'The argument to the ALL function must be either a reference to a base table or a reference to a base column. You cannot use table expressions or column expressions with the ALL function.' So that the column has to be physically present in the model.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.