Hi, Ive been trying to make a power query to merge two tables and keep them updated with new inputs every month. Hope that its not too confusing.
The idea is as follow:
1. Two separate tables, with one common column (EAN number), is imported into to individual queries by adding a custom column with the formula: "Excel.Workbook([Content])" - This is done for both of the tables and makes it possible for me to just drag and drop a raw excel file into a specific folder on my desktop and thereby update the table
2. Transform the imported table into a desired format. For both tables I will keep the filename in one column, which shows the month for the specific data.
3. Merge the transformed tables into one.
When this is done multiple records for the same month is created, because they are merged by EAN, meaning that e.g. EAN 1 for January (from the first table) is merged with both EAN 1 for January, February and marts (second table). So if I have data for three months, there will be six samples of each EAN - instead of three
4. To avoid this a conditional column is added with an if formula which says: If "the month from table 1" is the same as "the month from table 2" Then conditional column=month from table 1, Else it says "duplicate"
5. Then all "duplicates" is sorted out so that the only rows left is where table 1 is merged which table 2 correctly (same month)
All this works fine. The problem happens when one of the EAN's is only represented in one of the tables as they will not be merged.
Any ideas for how this can be solved?
The idea is as follow:
1. Two separate tables, with one common column (EAN number), is imported into to individual queries by adding a custom column with the formula: "Excel.Workbook([Content])" - This is done for both of the tables and makes it possible for me to just drag and drop a raw excel file into a specific folder on my desktop and thereby update the table
2. Transform the imported table into a desired format. For both tables I will keep the filename in one column, which shows the month for the specific data.
3. Merge the transformed tables into one.
When this is done multiple records for the same month is created, because they are merged by EAN, meaning that e.g. EAN 1 for January (from the first table) is merged with both EAN 1 for January, February and marts (second table). So if I have data for three months, there will be six samples of each EAN - instead of three
4. To avoid this a conditional column is added with an if formula which says: If "the month from table 1" is the same as "the month from table 2" Then conditional column=month from table 1, Else it says "duplicate"
5. Then all "duplicates" is sorted out so that the only rows left is where table 1 is merged which table 2 correctly (same month)
All this works fine. The problem happens when one of the EAN's is only represented in one of the tables as they will not be merged.
Any ideas for how this can be solved?