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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

error in union dax function result

I have a table that contains data extracted from a sql database, I duplicated it by changing your query to just the date of the data I need, for example in table 1 I have data from October and in table 2 I have data from january to september the structure of the two tables are exactly the same, when I perform the union function (table 1; table2) the resulting table has error in the data, for example I have the customer column and its values ​​are being displayed in the product column and this error occurs and several others. fields, how can I solve this?

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

You can use the SELECTCOLUMNS in your UNION to define the order.

 

NewTable =
UNION (
SELECTCOLUMNS ( Table1, "Field1",Table1[Field1],"Field2",Table1[Field2]),
SELECTCOLUMNS ( Table2, "Field1",Table2[Field1],"Field2",Table2[Field2])
)

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi @Anonymous 

If the two tables have the same column order? please keep them with same column order.

and you still have the problem, please share a simple sample pbix file.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jdbuchanan71
Super User
Super User

You can use the SELECTCOLUMNS in your UNION to define the order.

 

NewTable =
UNION (
SELECTCOLUMNS ( Table1, "Field1",Table1[Field1],"Field2",Table1[Field2]),
SELECTCOLUMNS ( Table2, "Field1",Table2[Field1],"Field2",Table2[Field2])
)

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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