Home » excel » excel – Power Query – Keeping Most recent records in change log columns

excel – Power Query – Keeping Most recent records in change log columns

Posted by: admin April 23, 2020 Leave a comment

Questions:

I need to strip records to show just the most recent for a given person, and I’m trying to think of a method for doing this in a custom column so I can just keep the most recent records. This is essentially a a status change list, and I need to match the last change as a “current status” for merging with another query. Each date can be unique, and each person can have any from 1 to a dozen status changes. I’ve picked a selection below, Last Names have been removed to protect the innocent. For sake of the example, Each “name” has a unique identifier that I can use to prevent any overlap from similar names.

 AaronS 4/1/2015
 AaronS 10/16/2013
 AaronS 5/15/2013
 AdamS  2/27/2007
 AdamL  12/16/2004
 AdamL  11/17/2004
 AlanG  11/1/2007
 AlexanderJ 7/1/2016
 AlexanderJ 1/25/2016
 AlexanderJ 4/1/2015
 AlexanderJ 10/16/2013
 AlexanderJ 6/1/2013
 AlexanderJ 11/7/2011

My goal would be to return the most recent date for each individual “name” and nulls for the other rows. Then I can filter out nulls to return one row per name. I’m fairly new to power query and mostly adept with the UI, barely learning M Code. Any help will be most welcome.

How to&Answers:

You can use Group By as illustrated in this video.