Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
when I union two same table, most data go to wrong column, who know how to fix this error, thank you
Solved! Go to Solution.
Hi @Anonymous,
You could modify the DAX for calculated table as:
Result Table = UNION ( SELECTCOLUMNS ( Table1, "Column1", Table1[Column1], "Column2", Table1[Column2], "Column3", Table1[Column3] ), SELECTCOLUMNS ( Table2, "Column1", Table2[Column1], "Column2", Table2[Column2], "Column3", Table2[Column3] ) )
That way can keep the same order for columns when you union two tables.
Regards,
Yuliana Gu
Hi @Anonymous,
This problem is caused by the different column orders of two tables.
The displayed column order in table view is not matched with that in the right fields pane. Please see below example:
Best regards,
Yuliana Gu
I know this is an old post but this may help others experiencing union problems. I found this tip re re-ordering columns in data view. Apparently the column order is determined by when the columns are added and not necessarily how you see them in Power Query. Tip: How to Change Column Order in Data View - Power BI - Enterprise DNA Forum
Yes, true, two table column have different order like your example, how to fix this without code ?
How to let data to show with right side column order?
in the Edit Query Mode, my table with same column order, how they change column order by Data tab?
Thank you for your help
Hi @Anonymous,
You could modify the DAX for calculated table as:
Result Table = UNION ( SELECTCOLUMNS ( Table1, "Column1", Table1[Column1], "Column2", Table1[Column2], "Column3", Table1[Column3] ), SELECTCOLUMNS ( Table2, "Column1", Table2[Column1], "Column2", Table2[Column2], "Column3", Table2[Column3] ) )
That way can keep the same order for columns when you union two tables.
Regards,
Yuliana Gu
I have the same problem, and your solution would work just fine BUT I have ten tables each with ten columns. I would then need a cumbersome UNION SELECTCOLUMNS with 100 lines !!!
Do you know of any other way to ensure columns remain in the same order, thus avoiding this workaround ?
Excellent solution.
My tables were generated in DAX so I could not use power query to join
I tried union for a lot of tables and luckily the columns match up but sometimes they did not so this method helps me avoid being lucky in using union and rely on accurate coding instead.
Most Grateful
Thank you so much. Your answer saving my lot of time...
Great answere ! very usfull.
I never used union as such, did you tried using "append" in power queyr and see if it works.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
93 | |
85 | |
84 | |
73 | |
49 |
User | Count |
---|---|
142 | |
133 | |
110 | |
68 | |
55 |