Power Query - Merge Creating Multiple Rows Where 2 Records Exist

karmaimages

Board Regular
Joined
Oct 1, 2009
Messages
112
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm using power query to looking some values against an external data source of user accounts.

So where I have for example

NameManager
Joe Bloggs(Lookup Value)

If the user has 2 or more accounts as they're been recreated for example

Display NameAccount NameManager
Joe BloggsJoe BloggsJane Doe
Joe BloggsJoe Bloggs2Jane Doe
Joe BloggsJoe Bloggs3Jane Doe

Where I'm linking on Name and Display Name to gather the manager name I'm getting the result as

NameManager
Joe BloggsJane Doe
Joe Bloggs
Joe Bloggs

This is messing up some counts that are needed for reports as it's creating necessary rows, how do I get Power Query to only add the one row not create multiple for the same person?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I'm not quite understanding what you are looking for as a final result, but I think you are wanting to see just 1 Joe Bloggs with 1 Jane Doe. So in order to do that, you would do a Group By with your Display Name and Manager as the Groupings, and then a Count of Rows as an Aggregation, which for this example, I have named as "Count of Accounts"

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Display Name", type text}, {"Account Name", type text}, {"Manager", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Display Name", "Manager"}, {{"Count of Accounts", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"
 
Upvote 0
After merging add a custom column and add something like
Power Query:
extData_[manager]
that should return the manager field from the first record of the merged external data table.
Mind M is case sensitive.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top