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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I calculate mil...
Power Apps
Answered

How do I calculate mileage?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi. I'm quite new to using PowerApps.

I'm working on a simple app where you create records to store in a Sharepoint list.

Three of the columns in each record would be "Travelling From", "Destination" and "Mileage".

 

The former two are Location type columns and Mileage is meant to be the distance, in miles, automatically calculated between

these two locations. I enter my starting and destination locations on my PowerApp, it calculates the mileage between them

and stores it in the record with them. Once I submit the form, a new item is created with that data in the Sharepoint list.

 

The question is how do I make that calculation?

Thanks.

Categories:
I have the same question (0)
  • Joel CustomerEffective Profile Picture
    3,224 on at

    Use the Bing Maps connector.

    You will need to go to https://docs.microsoft.com/en-us/bingmaps/getting-started/bing-maps-dev-center-help/getting-a-bing-maps-key and get an api key

     

    Once you have that, you can use the following expression to get the mileage between two locations

     

     BingMaps.GetRoute(
     TextInput1.Text,
     TextInput2.Text,
     { distanceUnit: "Mile" }).travelDistance

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks. But are there any other map services I can use?

  • Joel CustomerEffective Profile Picture
    3,224 on at

    Not as standard connectors but you can write a custom connector to any rest based API. Does Bing Maps not recogize your location?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I hadn't tried it yet, I'm just wondering why Bing seems to be the only option when there's also Google Maps.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi@PurpleHaze,

    Based on the issue that you mentioned, do you want to calculate the distance between two locations?

    Actually, the Location column is not the most efficient choice, you can just add three Text columns in your SP list to be filled with "Travelling From", "Destination" and "Mileage".

    In general, we use the Bing Map connector to locate and calculate distance. Yes, @jlindstrom provides the correct direction.

    Add a Button and set the OnSelect property as below.

    Set(
     Dis,
     BingMaps.GetRoute(
     TextInput1.Text,
     TextInput2.Text,
     {distanceUnit: "Mile"}
     )
    )

    Set the Text property of the corresponding "Mileage" control as below

    Dis.travelDistance & " " & Dis.distanceUnit

    002.png

    Best Regards,

    Qi

  • Joel CustomerEffective Profile Picture
    3,224 on at

    the connectors in Power platform are based on what those companies want to expose via Power Platform connectors. They own them. Google is a competitor to Microsoft and has a competitive app/forms product. they have recently restricted many of the existing google services connectors.

     

    the bing maps connector works well.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 431

#2
WarrenBelz Profile Picture

WarrenBelz 360 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 280 Super User 2026 Season 1

Last 30 days Overall leaderboard