Forum Discussion
o59393
Post Prodigy
6 years agoMerged queries is duplicating values
Hi all I need to add a column from one table to another using merge queries in Power query, in order to go from this is in table called "lines" to this: As seen, each of the ...
- 6 years agoYou have 'Cardboard' and 'Plastic' in your Month and Units table, so you get a month for each of those Materials, therefore you're getting 19 months * 3 rows in Lines table * 2 Materials in Month and Units table = 114 rows total.
I don't really understand why you need to duplicate the rows in the Lines table for each month? Can you use a DimDate table and some measures to achieve this result instead?
Otherwise try referencing the Month & Units table in a new query, do a Remove Duplicates on the Month column and use that for your merge.
Advanced Editor M script for the referenced query:
let
Source = Table2,
#"Removed Duplicates" = Table.Distinct(Source, {"Month"})
in
#"Removed Duplicates"
Where Table2 is your Month & units table.
Then use that new Query (name it DistinctMonths ? or something that makes sense to you) as your second table in the merge.
Syndicate_Admin
Administrator
3 years ago@o59393 Good afternoon, I ask you a question. I have the same problem where "for a certain critero (reason for high / low of employees of the month) brings me the values that coincide with such a person of my payroll of employees"; thus doubling the values for certain employees. In your case how did you solve it? I'm not sure what answers you were given.
Thanks in advance