Forum Discussion
Get most recent records
Hi Lutz, - it looks like we are facing similar problems - see my post at https://community.powerbi.com/t5/Desktop/Working-with-time-based-IOT-data-in-PowerBi-advice-needed/m-p/512849/highlight/true#M239668
The best advice I've seen for this kind of query is ...
1) Create a calculated column that tells you if this row is the latest for this particular sensor. You do this by first FILTERing against rows where the id is equal to the outer id (using EARLIEST) then look for the MAX timestamp. Once you have the timestamp, you can compare it to the current timestamp (using IF)
2) In the visual use the "is latest" column to filter the results.
If step one seeems ridiculously complicated when you might think you could just write LATESTBY(deviceId,timestamp,latitude) , I share your pain!
BTW - here's a worked solution https://community.powerbi.com/t5/DAX-Commands-and-Tips/Finding-the-most-recent-value/td-p/116838
And here is a useful video showing how you can create a query to do this... https://www.youtube.com/watch?v=5p5GYztKc9M&feature=youtu.be