Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Dax

Hi everyone,

 

I have some issues about creating a new table, 

 

I have 3 sheets from Excel and I have loaded into Power BI.

 

Sheet1 and Sheet2 are including with Name, Date and Balance, so they are basically the same thing. Sheet3 is only with Name and Age in it. So, what I am trying to do is going to creating a new table called t1, which will have Name, Date, Balance and Age in it.

 

I know how to do it in the query editor, but I want to do it just by using New table function from Modeling.

 

Also, I noticed I can use union to union sheet1 and sheet2 as they have the same number of rows. And right now, I have problem of adding sheet3 into it.

 

Thanks

  • Hi Anonymous,

     

    You could try this:

    FinalTable =
    ADDCOLUMNS (
        UNION ( Sheet_1, Sheet_2 ),
        "Age", LOOKUPVALUE ( Sheet_3[Age], Sheet_3[Name], [Name] )
    )

    Best regards,

    Yuliana Gu

4 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Anonymous,

     

    You could try this:

    FinalTable =
    ADDCOLUMNS (
        UNION ( Sheet_1, Sheet_2 ),
        "Age", LOOKUPVALUE ( Sheet_3[Age], Sheet_3[Name], [Name] )
    )

    Best regards,

    Yuliana Gu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks! It works out!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi everyone,

     

    I have some issues about creating a new table, 

     

    I have 3 sheets from Excel and I have loaded into Power BI.

     

    Sheet1 and Sheet2 are including with Name, Date and Balance, so they are basically the same thing. Sheet3 is only with Name and Age in it. So, what I am trying to do is going to creating a new table called t1, which will have Name, Date, Balance and Age in it.

     

    I know how to do it in the query editor, but I want to do it just by using New table function from Modeling.

     

    Also, I noticed I can use union to union sheet1 and sheet2 as they have the same number of rows. And right now, I have problem of adding sheet3 into it.

     

    Thanks

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous, 

       

      As you say, you can use the UNION function to join the first two tables, then you should create a relationship between this new table and Table3 by Name, to be able to create the final table with the following formula:

       

      FinalTable = ADDCOLUMNS (
          'Union';
          "Age" ; RELATED(Table3[Age])
          
      )

      Regards.