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
Hi mahoneypat !
Thank you very much for your answer.
It works perfectly well displaying the data of the table I put in my first message, but I created this table with fake data just to show the structure of the real table. In fact my real table is far bigger and looks like this :
I'm sorry I misled you. Is it still possible to make it work and access the data of my real table ?
Thank you very much !
Marion
The image is too blurry to use OCR to pull out the data to test it out. Can you share data copy/pasted from Excel, so I can put it into a query? In any case, from what I can see, it looks very similar to your example data (and already includes the State?). Did you try the query approach I suggested with your actual data?
FYI that I may not respond again until Monday.
Regards,
Pat
- Anonymous6 years agoNot applicable
Hi mahoneypat,
Actually, it would be great in my case if I could pull out the data directly from my table because the data is evolving and I want to be able to actualize without changing the code (but if it's too complicated, having to do it manually is still better than nothing).
Yes, the real data has a structure very similar to the fake one and already includes the State.
I was able to try the query approach with the steps you described, it worked and gave me the fake data, but I don't know how to adapt the query approach to have my real data.
Thank you very much !
Best regards,
Marion- mahoneypat6 years agoMicrosoft Employee
I wasn't proposing to use OCR as part of the solution. I was just looking to get some example data that matches your real data. Sometimes OCR can be used to extract the data from an image someone provides. In your case, the image was too blurry to do that. Please provide more representative data (either by inserting a table into your reply, or giving a link to an excel file, etc. I will then adapt the M code with the new data.
Regards,
Pat
- Anonymous6 years agoNot applicable
Hi mahoneypat ,
I not sure I understood what you need to modify your M code. If I sent you a small part of my actual data, would you be able to modify your M code so it would give me what I need for my entire data ?
If not, what do you need exactly ?
Thank you,Regards,
Marion