Forum Discussion
Anonymous
8 years agoNot applicable
after union two table, data go to wrong column
when I union two same table, most data go to wrong column, who know how to fix this error, thank you
- 8 years ago
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
v-yulgu-msft
8 years agoMicrosoft Employee
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
dennissheehan
7 years agoFrequent Visitor
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