Showing results for 
Search instead for 
Did you mean: 
Santiago95 New Member
New Member

DAX table variables

For the last couple of weeks I`ve been trying to incorporate variables in DAX codes. However, I´ve struggled deepley when defining tables as variables. The main problem comes up when trying to reference an existing column from the table previously defined as a variable, it seems that this can´t be done. Lets look at the following code for the better understanding of the problem. (The formula used is LOOKUPVALUE):


Measure =

VAR Table_1= GROUPBY('Indice de estacionalidad';'Indice de estacionalidad'[Codigo];"MAX";MAXX(CURRENTGROUP();'Indice de estacionalidad'[Promedio anual]))


LOOKUPVALUE( ‘ Here we would need to reference a column from the table Tabla_1 ’; …. ; ….




The example shown is very basic and variables should not be needed. However, this would be part of an even longer code, and defining tables as variable will make the code easier to read.

Another clear example would be instead of using LOOKUPVALUE, using ALL, were the columns of the virtual table cannot be accesed.


AlexisOlson Member

Re: DAX table variables

Yeah, it's an annoying limitation. However, there are workarounds.


For example, if you want to look up the [Promedio anual] for a given [Codigo], say, 123, then you can access it like this:


    FILTER(Table_1, [Codigo] = 123),
    [Promedio anual]

There's only one row for that [Codigo], so the max will just be whatever is in that column.

Community Support Team
Community Support Team

Re: DAX table variables

Hi @Santiago95,


Have you solved your problem?


If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.


If you still need help, please share some sample data and your desired output so that we could help further on it.


Best Regards,


Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.