cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

keep row based on a column for duplicate IDs in Power Query

Hi there,

 

i have a data table with columns ServiceDirectionCode and DateTo

 

Capture.PNG

 

I would like this data table to give me all the different ServiceDirectionCodes, and for the duplicate codes, I only want to keep the row with the latest DateTo.

 

Is this possible to do in the Query Editor?

 

Thanks,

Wes

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User IV
Super User IV

Re: keep row based on a column for duplicate IDs in Power Query

Hi,

 

You may use the Group By feature and take the maximum of the DateTo column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Moderator v-sihou-msft
Moderator

Re: keep row based on a column for duplicate IDs in Power Query

@wes-shen-poal

 

As @Ashish_Mathur suggsted, just have your records group on Code level with max aggregation on Date column.

 

Animation.gif

 

Regards,

View solution in original post

3 REPLIES 3
Super User IV
Super User IV

Re: keep row based on a column for duplicate IDs in Power Query

Hi,

 

You may use the Group By feature and take the maximum of the DateTo column.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Moderator v-sihou-msft
Moderator

Re: keep row based on a column for duplicate IDs in Power Query

@wes-shen-poal

 

As @Ashish_Mathur suggsted, just have your records group on Code level with max aggregation on Date column.

 

Animation.gif

 

Regards,

View solution in original post

Re: keep row based on a column for duplicate IDs in Power Query

Thanks @Ashish_Mathur@v-sihou-msft

 

Appreciate the help very much 🙂

 

Wes

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors