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

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.

Reply
hongyuliu
Helper III
Helper III

To show the latest location on map

I have a machine working in Germany last month and working in France this month. How to show only France on Map.

Machine TypeLocationDate
Truck 001Germany

2019/11/11

Truck 001France2019/12/12

My data table is like above. Thank you very much for your help.

2 ACCEPTED SOLUTIONS

You haven't mentioned FILTER in the formula.
See below:
CALCULATE(MIN(Maps[Location]),FILTER(Maps,Maps[Date]=LatestDate && Maps[Location]=Location))

The higlighted part needs to be in the query.

View solution in original post

v-jayw-msft
Community Support
Community Support

Hi @hongyuliu ,

 

Please refer to the calculated culumn below and see if the result achieve your expectation.

Column = 
VAR a =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Machine Type] = EARLIER ( 'Table'[Machine Type] ) )
    )
RETURN
    IF ( 'Table'[Date] = a, 'Table'[Location], BLANK () )

Here's my sample data and the result would be shown as below.

 1.PNG2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

6 REPLIES 6
v-jayw-msft
Community Support
Community Support

Hi @hongyuliu ,

 

Please refer to the calculated culumn below and see if the result achieve your expectation.

Column = 
VAR a =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( 'Table', 'Table'[Machine Type] = EARLIER ( 'Table'[Machine Type] ) )
    )
RETURN
    IF ( 'Table'[Date] = a, 'Table'[Location], BLANK () )

Here's my sample data and the result would be shown as below.

 1.PNG2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
rajulshah
Super User
Super User

Hello @hongyuliu ,

 

You can create a calculated column that fetches only the latest location and then use that column in the map visual.

Hope this helps.

Let me know if this didn't help.

Hi

 

Thanks for your reply.

What's the dax function for this?

Hey, 

You can use the following DAX function here:

Latest Location = 
VAR LatestDate = CALCULATE(LASTDATE(Maps[Date]),FILTER(Maps,Maps[Machine Type]=EARLIER(Maps[Machine Type])))
VAR Location = Maps[Location]
RETURN CALCULATE(MIN(Maps[Location]),FILTER(Maps,Maps[Date]=LatestDate && Maps[Location]=Location))


Please see the following image:

latestlocation.png

Hope this helps.

Untitled picture.png

Hi,

Please have a look at above pic. I followed your steps, but got error. what's the problem?

You haven't mentioned FILTER in the formula.
See below:
CALCULATE(MIN(Maps[Location]),FILTER(Maps,Maps[Date]=LatestDate && Maps[Location]=Location))

The higlighted part needs to be in the query.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.