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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.