Forum Discussion

sandeepsingh's avatar
sandeepsingh
Frequent Visitor
6 years ago

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

  • Greg_Deckler's avatar
    Greg_Deckler
    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.

  • AntrikshSharma's avatar
    AntrikshSharma
    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

     

    • sandeepsingh's avatar
      sandeepsingh
      Frequent Visitor

      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.

      • AntrikshSharma's avatar
        AntrikshSharma
        Community Champion
        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,