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
AlbLS
Frequent Visitor

Distance in a map to a non-fixed point.

Hi everyone,

I hope you could help me.

I have a dataset with a list of clients with their latitude and longitude.

I have created a map where I can show customers who are at a distance (in kilometers) from a specific point.

 

PBIDesktop_nnA06Rntjx.pngPBIDesktop_JwaemZp3v7.png

 

What I would like is, to be able to choose a client in a slicer. And then be able to show the clients who are at a chosen distance from him.

The formula for calculating the distance is as follows:

 

KLM: = 
ACOS (
    COS ( RADIANS ( 90 - 'clients_test'[lat_origine] ) )
        * COS ( RADIANS ( 90 - 'clients_test'[latitude] ) )
        + SIN ( RADIANS ( 90 - 'clients_test'[lat_origine] ) )
            * SIN ( RADIANS ( 90 - 'clients_test'[latitude] ) )
            * COS ( RADIANS ( 'clients_test'[long_origine] - 'clients_test'[longitude] ))
) * 6371

 

Currently, I put the latitude and longitude in a column. What I want is that those two data come from a variable or a measure.

 

I leave you my power bi file HERE


Thank you very much in advance.

 

AlbLS

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@AlbLS 

 

You may try SELECTEDVALUE to add a measure.

https://community.powerbi.com/t5/Desktop/Mapping-question/m-p/365056#M165061

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

Hello @v-chuncz-msft ,

Thank you very much for your answer.

Could you explain a little more in detail what you mean, please?

I need to select a client in a slicer. Then, choose a distance to that client and that only the clients that are at the chosen distance of the first client are shown on the map.

How do I have to use the SELECTVALUE formula?

Thank you

AlbLS

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.