Forum Discussion
Keep latest time value
Hey guys,
I am looking for a way to keep the latest time value
Quite simply: I have a multiple time records per unit, everyday but only want the last time reported for each unit, everyday.
I am trying to make the changes in Power Query, using M (or whatever method would be best).
Thank you very much, in advance, for your help with this!
- Anonymous7 years ago
Update to this post: The only solution I found was to write a SQL script, into the advanced options window (get data window), which selects the last date of the week and the highest value of the day.
10 Replies
- rafaelmpsantosResponsive Resident
Hi...
In power query Sort yout Date Column Descending then in Home menu click on "Queep Rows">"Keep Top Rows" will open a dialogue box in numbers of rows type 1 then OK.Done.
- AnonymousNot applicable
Hi rafaelmpsantos,
Thanks for your reply! However there are more than one serial numbers (unit), with multiple data/time values. In fact, the time has 40+million rows.
So, I'm trying to reduce the number of rows by only keeping one data/time value per day per serial number (unit).
receivedTime serialNumber 1/1/2018 10:00:00 AM abcd1234 delete 1/1/2018 11:00:00 AM abcd1234 delete 1/1/2018 12:00:00 PM abcd1234 delete 1/1/2018 1:00:00 PM abcd1234 delete 1/1/2018 2:00:00 PM abcd1234 KEEP 1/1/2018 3:00:00 PM efgh5678 delete 1/1/2018 4:00:00 PM efgh5678 delete 1/1/2018 5:00:00 PM efgh5678 delete 1/1/2018 6:00:00 PM efgh5678 delete 1/1/2018 7:00:00 PM efgh5678 KEEP 1/1/2018 9:00:00 AM ijkl9012 delete 1/1/2018 10:00:00 AM ijkl9012 delete 1/1/2018 11:00:00 AM ijkl9012 delete 1/1/2018 12:00:00 PM ijkl9012 delete 1/1/2018 1:00:00 PM ijkl9012 KEEP 1/1/2018 7:00:00 AM mnop3456 delete 1/1/2018 9:00:00 AM mnop3456 delete 1/1/2018 11:00:00 AM mnop3456 delete 1/1/2018 1:00:00 PM mnop3456 delete 1/1/2018 3:00:00 PM mnop3456 KEEP … so on and so forth - Ashish_MathurSuper User
Hi,
In the Query Editor, right click on the serialNumber column and see the images below. CLick on OK to get the result (see second image below)
Hope this helps.