Forum Discussion
Creating a reference table from other tables using power quesry
- Anonymous2 years ago
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
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 CombinedFirst 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:
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
Open the advanced editor and paste the M code above:
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.
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?
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
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:
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
Open the advanced editor and paste the M code above:
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.
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.
- MaryamSe2 years agoFrequent Visitor
Hi, Anonymous Thank you for your great help!