Power Query - remove select row duplicates based on a sequential row index?

SOQLee

Board Regular
Joined
Mar 18, 2015
Messages
58
Office Version
  1. 365
Platform
  1. Windows
In Power Query, I have a [RID] column set up that identifies the rows sequentially. I would like to remove the first UserID duplicate. Does anyone know how to write the formula in Power Query?

For example:

RID | UserID | Code
1 | 999999999 | Red
2 | 999999999 | Orange
3 | 888888888 | Red
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Table.RemoveDuplicates will always keep the first row.
So if you sort your table on RID ascending, this should normally do.
But there is a kind of a bug in Power Query that won't keep the sort-order, unless you wrap your sorting-step with a Table.Buffer:

Table.Buffer(Table.Sort(Source,{{"RID", Order.Ascending}}))
 
Upvote 0
Appreciate the quick reply! I wasn't aware of the bug. I sorted RID in descending order and wrapped the step with a Table.Buffer. Worked like a charm. Thank you :)



Table.RemoveDuplicates will always keep the first row.
So if you sort your table on RID ascending, this should normally do.
But there is a kind of a bug in Power Query that won't keep the sort-order, unless you wrap your sorting-step with a Table.Buffer:

Table.Buffer(Table.Sort(Source,{{"RID", Order.Ascending}}))
 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,109
Members
449,205
Latest member
ralemanygarcia

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