Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a data dump from a vehicle tracking system, that records the time, location etc each time a vehicle's ignition is switched on or off. A simplified view is as below:
Vehicle | Status | Time | Location |
Vehicle A | START | 14/07/2020 14:44 | N26°08.853 E049°53.233 |
Vehicle A | STOP | 14/07/2020 13:59 | N26°08.050 E049°52.450 |
Vehicle A | START | 14/07/2020 13:29 | N26°14.482 E049°59.775 |
Vehicle A | STOP | 14/07/2020 11:59 | N26°15.993 E050°01.205 |
Vehicle A | START | 14/07/2020 11:43 | N26°10.472 E049°55.988 |
Vehicle B | STOP | 14/07/2020 19:29 | N24°07.455 E049°06.635 |
Vehicle B | START | 14/07/2020 19:14 | N24°12.902 E049°05.660 |
Vehicle B | STOP | 14/07/2020 18:29 | N24°42.993 E049°05.212 |
Vehicle B | START | 14/07/2020 17:59 | N24°43.668 E049°05.543 |
I have then created a second table which just lists the vehicles. How can I populate that table with only the most recent records from the data dump (the blue lines above)?
Thanks!
Solved! Go to Solution.
@Anonymous
Add this in your vehicles table:
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @Anonymous,
Wow @parry2k and @Fowmy are fast,
Another approach would be to derive the rows you are looking for during data ingestion. see the linked .pbix.
essentially ranks the data in power query then creates a filtered table where the rank = 1
Proud to be a Super User!
I like the look of your solution, saves the need for the second table, but I'm not sure how you got to the stage in your screenshot? I have very limited knowledge of the query editor 😕
@Anonymous
Add this in your vehicles table:
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Sorry, thought that was all I needed - how can I edit that to pull through the other columns (status, location etc)?
@Anonymous
If you need a new table that brings only the records for each vehicle with its latest date, add this code by clicking on the New Table under Home tab:
Latest Dates Table=
FILTER(
'Table',
VAR _MAX =
CALCULATE(
MAX('Table'[Time]),
ALLEXCEPT('Table',VEHICLES[Vehicle])
)
RETURN
'Table'[Time] = _MAX
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Thank you! I think this is exactly what we need 👍
@Anonymous add a measure using following expression:
Recent Date =
CALCULATE ( MAX ( Table[Date] ), ALLEXCEPT ( Table, Table[Vehicle] ) )
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you! Thought it was an easy thing, I was just missing EARLIER.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |