Forum Discussion
distance calculation : optimized route mapquest api
- 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
You will need to adapt your real query with the approach I showed in the example. Starting with the #"Grouped Rows" step forward. Once you get the text string of cities, you'll then need to concatenate that string into the longer URL web call to return your results.
Regards,
Pat
Hi mahoneypat,
What do I have to do to adapt the code you wrote to my real query ? I don't know how to do it.
What do you mean by "Starting with the #"Grouped Rows" step forward" ?
Thank you,
Regards,
Marion
- mahoneypat6 years agoMicrosoft Employee
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
- Anonymous6 years agoNot applicable
It works great.
I would never had known how to do this by myself. Thank you very much for all your help !
Regards,
Marion