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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

create table from different column of different tables

 Hi,

 

I am trying to built a table which needs to contain different columns from two different related tables.Table 1 contains two column (let say description and subdescription);table 2 contains several measures and one related column from table 1 (1 to 1 mapped, with subdescription). Please suggest how could I achieve that.

 

What I was trying with SELECTVALUES and ADDVALUES on create table option but it takes only one table column and doesnot allow other table.Also  I ve tried with append query but its just putting NULL values in related columns.

 

Please

1 ACCEPTED SOLUTION
TeigeGao
Solution Sage
Solution Sage

Hi pundiv01,

According to your description, my understanding is that you want to create a table with some columns from different tables. In this scenario, we can use the ADDCOLUMN() and SELECTCOLUMNS() function, please refer to the following example:

Create two tables ‘Table1’, ‘Table2’ like below:

111.png222.png

Then use the following DAX query to create a table:

Table = ADDCOLUMNS(SELECTCOLUMNS(Table1,"Description",Table1[description]),"Column1",MIN(Table2[Column1]),"Column2",MIN(Table2[Column2]))

The result will like below:

333.png
In your scenario, you may need to change DAX to “Table = ADDCOLUMNS(SELECTCOLUMNS(Table1,"Description",Table1[description]),"Column1",Measure1,"Column2",Measure2)”.

Best Regards,

Teige

View solution in original post

1 REPLY 1
TeigeGao
Solution Sage
Solution Sage

Hi pundiv01,

According to your description, my understanding is that you want to create a table with some columns from different tables. In this scenario, we can use the ADDCOLUMN() and SELECTCOLUMNS() function, please refer to the following example:

Create two tables ‘Table1’, ‘Table2’ like below:

111.png222.png

Then use the following DAX query to create a table:

Table = ADDCOLUMNS(SELECTCOLUMNS(Table1,"Description",Table1[description]),"Column1",MIN(Table2[Column1]),"Column2",MIN(Table2[Column2]))

The result will like below:

333.png
In your scenario, you may need to change DAX to “Table = ADDCOLUMNS(SELECTCOLUMNS(Table1,"Description",Table1[description]),"Column1",Measure1,"Column2",Measure2)”.

Best Regards,

Teige

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.