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.
Hi mates,
I have got multiple csv files to be imported to Power Bi. They all have the same number of rows but different columns hence, need to be merged and not appended. When using the Power Bi default, the data are combined (appended) which I do not need. I need the data to sit across (merging) and come up with the same number of rows at the end. Any indication of how can I do this when I am importing the data from the source?
Regards,
Hi, @Alirezam
If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.
Best Regards
Allan
Hi, @Alirezam
As is said in the document , if you use folder connector to combine files, it will append multiple files that have the same schema, combine them into a single logical table. I'd like to suggest you use 'Text/CSV' connector to connect to CSV files. Then you may go to 'Home' ribbon, click 'Merge Queries', set as below.
Finally you may expand the column 'File2' to get the result.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Alirezam , Append should work as you will have additional columns where the column name do not match.
https://radacad.com/append-vs-merge-in-power-bi-and-power-query
https://www.youtube.com/watch?v=4fFL7Ok7Ovg
Dax : https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/
Prefer the option of merge in data transformation
Thanks,
My problem is not with the queries. My question was when you import the csv files. when you select the multiple csv files to import, the Combine option only append the files
Did you know that behind the scenes both Append and Merge are served by the same Table.Combine statement?
Just use Append and trust Power Query to sort out the columns.
HOWEVER: for this to work the spelling of the column names has to be consistent. Remember that M code is case sensitive.
After the Table.Combine you want to use Table.SelectColumns rather than Table.RemoveColumns, for hopefully obvious reasons.
Thanks for your reply.
When we use 'combine' as you suggested, the files get appended and not merged. The column names are not consistent and should not be because I need to have them next to each other and not on the top of each other. Look below please: if you use append C1 will be on the top of D3 which does not make sense.
File 1:
Date | C1 | C2 |
4/12/2019 | 5 | 6 |
1/3/2019 | 10 | 12 |
File 2:
Date | D3 | D8 |
4/12/2019 | 4 | 6 |
1/3/2019 | 3 | 10 |
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 |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |