Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

distance calculation : optimized route mapquest api

Hi ! I'm using the MapQuest API that calculates the optimized route given a starting location and several served locations. For each trip, given the different locations, I want to have the distance...
  • mahoneypat's avatar
    mahoneypat
    6 years ago

    Here is some additional instruction

    1. Starting with your existing query, group it on the Trip_ID and Start_Location columns, using the Group By button in the ribbon.  Call the column "Locations".  Choose All Rows as the aggregation.

    2.  Add a custom column called "ListOfLocations" with this formula -    = List.Combine({{[START_LOCATION]}, [Locations][SERVED_LOCATION]}) 

    3.  Add a custom column called "ListInQuotes" with this formula -    = Text.Combine(List.Transform([ListOfLocations], each """"&_&""""), ", ")

    4. Concatenate that new column with the rest of your web call to get your results on each row/for each Trip_ID

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat