Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying to make a union between two of the same table. I am following a tutorial on how to make tables incrementally load: Incrementally Load tables.
First I import the original tables the default PowerBI way which imports every column into a table. On those tables you can right click and view the source query which I copied and pasted into a new table where I simply add a where clause to the end to narrow in on the new data.
Then I go to modeling in the ribbon and create a new table with a union like so: tbl_union = UNION('tbl_old_data','tbl_new_data').
The issue is sometimes the tables will Union together just fine, then others will complain the number of columns don't match up.
The error message: "Each table argument of 'UNION' must have the same number of columns."
Each table I did this to, I followed the same exact process. It is really weird only some tables get this error and others don't. I have a feeling the problem is due to some kind of type mismatch with a column from each table. I'm pretty sure the default import is importing some columns as a different type than when the data came from a query.
Can anyone help clarify what is wrong here?
Hi @kferrone,
If you can't ensure these columns will be changed, you can try to use SELECTCOLUMNS function to choose specific columns.
Merged Table= UNION( SELECTCOLUMNS('Table1',"COLUMN1",[Column1],"COLUMN2",[Column2],...), SELECTCOLUMNS('Table2',"COLUMN1",[Column1],"COLUMN2",[Column2],...), SELECTCOLUMNS('Table3',"COLUMN1",[Column1],"COLUMN2",[Column2],...) )
You can also try use Table.InsertRows(Power query) to merge there tables.
In addition, if above not help, can you please share some sample data to test?
Regards,
Xiaoxin SHeng
I get this error even when using ADDCOLUMS to choose my colums from each table. Why does UNION think I don't have the same number of columns from each table?
Thank you. This really helped:)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
98 | |
78 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |