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. I have a general question about appending tables and by that to automate procedures.
I have Sales table from April. There are the useal columns + a column that I created by merging two columns.
I first duplicated two columns and then merged tham so keeping the original files.
Now I have an extra column.
I want to append an exact same file from May. It doesn't of cours have this extra column.
In the appended file (Sales) the data in the extra column for may in NULL. It didn't merge the data of the two columns.
Well, the two colums are those I duplicated and they don't exist.
How can I do that?
Maybe if I could merge the columns and keep the originals.
thanks Giora
Solved! Go to Solution.
Hi gtamir,
"is it possible to merge as new?"
<-- Yes, change step Merged Columns with M code below:
= Table.AddColumn(#"Changed Type", "Merged", each Text.Combine({Text.From([PharmacyCode], "zh-CN"), Text.From([CustomerCode], "zh-CN")}, "-"), type text)
"It didn't merge the columns for the appended file."
<-- "Append" operation will not automactically merge columns in the appended table. As a workaround, to achieve your requirement, you can append 'Sheet1' to 'Sales' firstly, then Merge columns PharmacyCode and CustomerCode as a new merged column.
Hope it's helpful to you.
Jimmy Tao
Hi
Sales Apr file ->Have the original columns( say 10 columns) + 1 new concatenated column. Delete the dupicated columns as they are not required in the data model. So, total 11 columns
Sale May file -> This has the original columns (10) only
If you append both now, all 10 columns data will be appended and FOr the 11th column you will see data for Apr & null for May month.
Hope this clarifies you.
Thanks
Raj
This would be easier to advise on if you could upload a sample of the first and second file and what you want the result to look like. If your files are of the same format, then the steps and Power Query should treat them the same. You can handle changes in titles before sending it through the logic that adds calculated columns/appends to ensure the data is treated the same.
https://drive.google.com/file/d/1PAC8ncuJE-oPaA-cRnRKXQ3oaqdAihGu/view?usp=sharing
https://drive.google.com/file/d/1lggWeBGRKyh4YdlLbWX04Y99o7mbDz-L/view?usp=sharing
https://drive.google.com/file/d/1l5fW2O80YMwIlkk0PQoWET00Zf5K20NH/view?usp=sharing
Thank you. I attached 3 files. File A, File B are the source files, and AppendTest.PBIX.
The old columns are gone. (is it possible to merge as new?)
Thanks Giora
Hi gtamir,
"is it possible to merge as new?"
<-- Yes, change step Merged Columns with M code below:
= Table.AddColumn(#"Changed Type", "Merged", each Text.Combine({Text.From([PharmacyCode], "zh-CN"), Text.From([CustomerCode], "zh-CN")}, "-"), type text)
"It didn't merge the columns for the appended file."
<-- "Append" operation will not automactically merge columns in the appended table. As a workaround, to achieve your requirement, you can append 'Sheet1' to 'Sales' firstly, then Merge columns PharmacyCode and CustomerCode as a new merged column.
Hope it's helpful to you.
Jimmy Tao
Thank you. I will have to do this every month.
I think the solution will be to upload the new file, do some changes, and then append.
Giora
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 |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |