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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
MaryamSe
Frequent Visitor

Creating a reference table from other tables using power quesry

Hi, 

I have 4 tables that they include differet columns with different names. However, all include a date column, and an ID. I want to create a new table in power query that I can use a refernce table in my tables relation that inlcude all the date and IDs from all other tables. The new tables should get updated anytime other tables get updated.

The updated tabels may have more or less rows fro each year.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @MaryamSe 

Thank you very much for your reply. If you want to append the previously selected column, you can use M code similar to the following

vjianpengmsft_5-1713506202138.png

vjianpengmsft_6-1713506215807.png

vjianpengmsft_7-1713506228404.png

 

let
    Source1 = Sheet6,
    Source2 = Sheet1,
    Source3 = Sheet7,
    FirstTable = Table.SelectColumns(Source1, {"id","date"}),
    SecondTable = Table.SelectColumns(Source2, {"id","date"}),
    ThirdTable = Table.SelectColumns(Source3,{"id","date"}),
    Combined = Table.Combine({FirstTable, SecondTable,ThirdTable})

in
    Combined

First of all, the source1, source2, and source3 equal signs are followed by the query names on the left side of PowerQuery, as shown in the following figure:

vjianpengmsft_0-1713505418713.png

Then use the Table.SelectColumns function to select the id and date columns in these tables. The selected columns are appended at the end. 

Here are some steps:

First, right-click on the blank space on the left side of the mouse to create a blank query

vjianpengmsft_1-1713505726063.png

Open the advanced editor and paste the M code above:

vjianpengmsft_2-1713505793462.png

You need to replace the name after the source1-3 equals sign above with your actual query name. You can also add more sources, similar to the ones above.

vjianpengmsft_3-1713505839160.png

vjianpengmsft_4-1713505869205.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi, @MaryamSe 

Based on your description, I used Excel to create two sub-tables, which have id and date columns, and each has other columns with different names, as shown in the following figure:

vjianpengmsft_0-1713408532774.png

vjianpengmsft_1-1713408541690.png

I use Power BI to connect to this workbook, as shown in the following image:

vjianpengmsft_2-1713408623498.png

In Power Qury, you only need to append two or more tables, generate new tables, and then delete other columns, as shown in the following figure:

vjianpengmsft_3-1713408744879.png

vjianpengmsft_4-1713408824620.png

vjianpengmsft_5-1713408870913.png

vjianpengmsft_6-1713408886730.png

When I update sheet1 in Excel, this appended table is updated as well:

vjianpengmsft_7-1713408985881.png

vjianpengmsft_8-1713409018512.png

vjianpengmsft_9-1713409050033.png

The appended table is also updated:

vjianpengmsft_10-1713409104050.png

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Hi!

Thank you very much! Solved. Howvere, I needed to move some of the columns bceuase the tables do not have teh same order. e.g. date is the third column on one and the tenth  in the secind one. Is there any way that I can select columns before appending? 

Anonymous
Not applicable

Hi, @MaryamSe 

Thank you very much for your reply. If you want to append the previously selected column, you can use M code similar to the following

vjianpengmsft_5-1713506202138.png

vjianpengmsft_6-1713506215807.png

vjianpengmsft_7-1713506228404.png

 

let
    Source1 = Sheet6,
    Source2 = Sheet1,
    Source3 = Sheet7,
    FirstTable = Table.SelectColumns(Source1, {"id","date"}),
    SecondTable = Table.SelectColumns(Source2, {"id","date"}),
    ThirdTable = Table.SelectColumns(Source3,{"id","date"}),
    Combined = Table.Combine({FirstTable, SecondTable,ThirdTable})

in
    Combined

First of all, the source1, source2, and source3 equal signs are followed by the query names on the left side of PowerQuery, as shown in the following figure:

vjianpengmsft_0-1713505418713.png

Then use the Table.SelectColumns function to select the id and date columns in these tables. The selected columns are appended at the end. 

Here are some steps:

First, right-click on the blank space on the left side of the mouse to create a blank query

vjianpengmsft_1-1713505726063.png

Open the advanced editor and paste the M code above:

vjianpengmsft_2-1713505793462.png

You need to replace the name after the source1-3 equals sign above with your actual query name. You can also add more sources, similar to the ones above.

vjianpengmsft_3-1713505839160.png

vjianpengmsft_4-1713505869205.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi, @Anonymous Thank you for your great help!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.