Forum Discussion

tctrout's avatar
tctrout
Icon for Responsive Resident rankResponsive Resident
6 years ago
Solved

GENERATESERIES[Value] reference

Hello,  

 

I have a base question where I would like to know why I cant 'qualify' the table name for the column [Value] that is created i the GENERATESERIES() measure.  See the below example.  

 

I find it confusing to only refer to [Value] and prefer to qualify it with the table name first.

 

//This DAX Works

TableTest =
var SeriesTest = GENERATESERIES(1,10,1)

var AddColumnTest =
ADDCOLUMNS(SeriesTest
                             ,"ColumnAdd"
                            ,[Value])  //However, why cant this be referred to as SeriesTest[Value]

return
AddColumnTest
  • Anonymous's avatar
    Anonymous
    6 years ago
    Because SeriesTest is a name for a variable, not for a table. The table created by the function is anonymous.

    Best
    D

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    Because SeriesTest is a name for a variable, not for a table. The table created by the function is anonymous.

    Best
    D
    • tctrout's avatar
      tctrout
      Icon for Responsive Resident rankResponsive Resident

      Ah, thank you, I forgot that when used in a variable the table doenst actually 'materialize'.  I confirmed, once 'materialized', I can qualify it in another calculated table:

       

      TableTest2 =
      ADDCOLUMNS(TableTest,"ColumnAdd2",TableTest[Value])
       
      I do have a follow up, and not sure of the scenario, but what if the DAX requires multiple GENERATESERIES()?  How will it know which [Value]?  Or will it not allow me, and the work around would be to nest another return with a new var GENERATESERIES()?  
      • Anonymous's avatar
        Anonymous
        Not applicable
        // Easy enough to check...
        // This gives you an error:
        
        EVALUATE
        	CROSSJOIN(
        		GENERATESERIES(1, 10, 2),
        		GENERATESERIES(2, 10, 2)
        	)
        
        // You can do this instead:
        EVALUATE
        	CROSSJOIN(
        		GENERATESERIES(1, 10, 2),
        		SELECTCOLUMNS(
        			GENERATESERIES(2, 10, 2),
        			"Value2", [Value]
        		)
        	)

         

        Best

        D