Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:)
User | Count |
---|---|
76 | |
75 | |
46 | |
31 | |
27 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
45 |