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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Duplicating tables but have column differences

I have a table being pulled into Power Query with a date range filter and then transformations. I've duplicated this table so that 

Table1 does not refresh (historical data) and Table2 is new data.

Table1_hist contains data from 1/1/2022 - 6/30/2023 and Table2 (new) contains data from 7/1/2023 to 12/31/2023.  They have the exact same transformations after the date filter.  

Table1_hist

dpibarker_0-1689201119873.png

Table2 (new)

dpibarker_1-1689201190521.png

 

After both tables are loaded, the columns are out of order and I cannot UNION the tables. Why do the tables have a different column order and how do I fix this?

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Anonymous ,

 

It is a known fact that, once a query, has been loaded into othe data model the columns do not re-order even if you re-order them in Power Query (an idea has been posted to re-arrange the columns in data view but https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=a272113a-0f44-41ac-a402-bf1066984cda).  New custom columns  even if you put them in the far left in Power Query will be added to the far right in the data view once the change has been applied. You might  have changes or added new custom columns in Power Query to your first table after you first loaded it. In that case, I would use SELECTCOLUMNS before creating a union between the two tables. Please see sample formula below.

UNION =
VAR __TBL1 =
    SELECTCOLUMNS ( Table1, "Name1", Table1[Column1], "Name2", Table1[Column2] )
VAR __TBL2 =
    SELECTCOLUMNS ( Table2, "Name1", Table2[Column1], "Name2", Table2[Column2] )
RETURN
    UNION ( __TBL1, __TBL2 )

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

1 REPLY 1
danextian
Super User
Super User

Hi @Anonymous ,

 

It is a known fact that, once a query, has been loaded into othe data model the columns do not re-order even if you re-order them in Power Query (an idea has been posted to re-arrange the columns in data view but https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=a272113a-0f44-41ac-a402-bf1066984cda).  New custom columns  even if you put them in the far left in Power Query will be added to the far right in the data view once the change has been applied. You might  have changes or added new custom columns in Power Query to your first table after you first loaded it. In that case, I would use SELECTCOLUMNS before creating a union between the two tables. Please see sample formula below.

UNION =
VAR __TBL1 =
    SELECTCOLUMNS ( Table1, "Name1", Table1[Column1], "Name2", Table1[Column2] )
VAR __TBL2 =
    SELECTCOLUMNS ( Table2, "Name1", Table2[Column1], "Name2", Table2[Column2] )
RETURN
    UNION ( __TBL1, __TBL2 )

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors