web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Unanswered

Calculate distance

(0) ShareShare
ReportReport
Posted on by
  1. Hi

 

I just discover PowerApps and i want to know if it s possible to make an app for calculate distance between two adresses. i want my user can have a file where all professionnal car ride can be save per month for each month.

 

Example :

 

- User enter the date of path

- User type city 1 to city 2 API (if i can have some predictive adresse like Waze or other GPS apps it s better)

- API calculate kilometer for ride car between 2 points

- Then save the result into a file where title is username and month = User1August2017

- in this file i can have all the drive path of the august month and a formula can calculate with a ratio the fee to refund for my employee.

 

Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    on at

    Hi Giulian,

     

    I think this cannot be achieved in PowerApps so far.

     

    You could post this idea in the PowerApps Ideas forum, so it might be considered for future releases.

    https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

     

    Regards,

    Mona Li

  • Community Power Platform Member Profile Picture
    on at

    yeah i don t see API plugin for calculate distance between two points like google map our other.

     

    I can do it with excel file, so for moment i try to do an App for just collect data per user into database

  • Community Power Platform Member Profile Picture
    on at

    Is there any news about this feature ?

     

    Thanks

  • Verified answer
    CarlosFigueira Profile Picture
    on at

    You can use the Bing Maps connector to calculate a distance between two cities:

    ForumPost001.PNG

    Once you have that connection added, you can use the GetRoute function to calculate the distance between two addresses. For example, in a button you can have the following formula on its OnSelect property:

    Set(dist, BingMaps.GetRoute("San Francisco, CA", "Los Angeles, CA"))

    And after clicking the button you can get the distance by accessing the properties in the dist variable, for example, in the Text property of a label:

    "Distance: " & dist.travelDistance & " " & dist.distanceUnit
  • JEastman12 Profile Picture
    4 on at

    This is great, worked like a charm!

  • Community Power Platform Member Profile Picture
    on at

    @CarlosFigueira Hello! How do you converted the distance to display in Miles instead of KM?

  • CarlosFigueira Profile Picture
    on at

    You can request the unit to be returned in miles from the Bing Maps connector itself:

    Set(
     dist,
     BingMaps.GetRoute(
     "San Francisco, CA",
     "Los Angeles, CA",
     { distanceUnit: "Mile" }))

    You can find more details on the documentation for the Bing Maps connector.

  • Community Power Platform Member Profile Picture
    on at

    Thanks! @CarlosFigueira It seems to be working for most of the states I've tested except Delaware. For example,  from Middletown, DE to Camden, DE is about 30 miles, but PowerApps is displaying 305 miles instead. Any reason why this may be happening?

  • CarlosFigueira Profile Picture
    on at

    Not sure - the results come from Bing directly. Can you try looking at the "dist" variable (on the ribbon, select View -> Variables, then select it), especially the "routeLegs" property, to see if it the start/end points actually match the results. Sometimes it's possible that Bing will consider one of your start/end points a place other than the one that you want.

    InspectingVariable.gif

  • Community Power Platform Member Profile Picture
    on at

    @CarlosFigueira @v-monli-msft 

     

    Distance1.jpg

    What about creating a gallery and having the miles populate for each row? So far, I see that I can press a button to calculate the miles. Could this feature become dynamic? 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard