Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
goose464
Microsoft Employee
Microsoft Employee

Latest date time to map

I have a table of gps coordinates and date time. 

 

goose464_0-1617637492220.png

 

I want to only display the most recent latitude and longitude on a map, NOT all values like you see below.

 

goose464_1-1617637685310.png

 

 

I have tried using LASTDATE filter in CALCULATE function but it doesn't support time granularity and throws an error complaining about duplicate days.

 

How do I get the latitude and longitude based on most recent date time?

 

 

 

5 REPLIES 5
AlexisOlson
Super User
Super User

You can calculate the latest datetime and then select the latitude and longitude associate with that datetime.

 

LatestLat =
VAR LastTime = MAX ( Table1[datetime] )
RETURN
    CALCULATE ( SELECTEDVALUE ( Table1[latitude] ), Table1[datetime] = LastTime )

Thanks for the reply. I feel like this is really close to what I need. It appears to work for a card tile but map viz doesn't seem to like using a measure for latitude and longitude. 

 

goose464_0-1617643874893.png

 

It looks like I can force it by using a SQL query when adding the PBI source... but this feels janky.

 

goose464_1-1617644556878.png

 

 

Hmm. I guess I'm not very familiar with using maps. It seems weird not to be able to use measures.

 

In light of this, I'd propose a different method entirely. Use a filter on the datetime column like this

 

AlexisOlson_0-1617649380628.png

 

So I tried this, one hitch, it doesn't update when auto-refreshing. 

Jihwan_Kim
Super User
Super User

Hi, @goose464 

Instead of Lastdate, please try to use MAX 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.