cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Join multiple tables and Move Columns

Hi everyone,

I hope someone can help me, 
Sorry if this is not the forum, but I don't know if the problem is in Desktop or Power Query ... I explain my situation:

 

I have 3 large volume databases. They are identical, but for some reason Power Bi desktop changes the order of the columns in the first table.

 

It's weird because in Power Query, I see the preview structure for all databases as (exemple):
Column A = Customer, Column B = Date, Column C = Product Code and Column D = Quantity.

 

But when I apply the changes and load the data ... this happens in Power BI Desktop:

 

Table 1

CustomerDateQuantityProduct Code

 

Table 2

CustomerDateProduct CodeQuantity

 

Table 3

CustomerDateProduct CodeQuantity

 

To solve it I use the "move columns" function in Power Query but nothing changes ...:
 = Table.ReorderColumns (# "Previous step", {"Customer", "Date", "Product Code", "Quantity" "}),

This is a problem, because when I want to create a new table by joining the 3 tables through the DAX function "JOIN", the data is not added correctly (because mix quantity data and product code data)

 

Thank you very much in advance!!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Append or merge both append or join tables based on the column names, whey order is important.

 

This seems like an append case and it should work with name



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

View solution in original post

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

As far as I know, the Power BI Desktop displays the column order according to the change when the column last time sort, and power Query sometimes does not correspond, but does not affect the merge table, as long as your column name relative to, can be merged, such as:

vyalanwumsft_0-1635131785287.png

when union it by dax .

 

New table = UNION('Table1','Table2')

 

The final output is shown below:

vyalanwumsft_1-1635131834317.png

If you can't , can you share how to  join about your method and share more screenshoots about y?
Best Regards,
Community Support Team_ Yalan Wu
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

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

As far as I know, the Power BI Desktop displays the column order according to the change when the column last time sort, and power Query sometimes does not correspond, but does not affect the merge table, as long as your column name relative to, can be merged, such as:

vyalanwumsft_0-1635131785287.png

when union it by dax .

 

New table = UNION('Table1','Table2')

 

The final output is shown below:

vyalanwumsft_1-1635131834317.png

If you can't , can you share how to  join about your method and share more screenshoots about y?
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Append or merge both append or join tables based on the column names, whey order is important.

 

This seems like an append case and it should work with name



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show Episode 10 Recap

The Power BI Community Show

Watch the playback when Amit Chandak, a Power BI Super User, demos how to use Field Parameters to make reports more dynamic.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.

Top Solution Authors