Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Calculate overall drive time from a set of points


Hello All!


I have an odd conundrum. I am using the spatial package and am trying to come up with a way to give an overall drive time (or an index of drivetime of some sort) from a series of points. The problem I have is that I don't have a start or end point (you could hypothetically start or end at any of them), but what I'm hoping to do is find maybe the drive time of doing a "lap". Essentially, driving from one of the points, then driving to the next nearest point, hitting them all and returning to the point I started without repeating any of them. Does anyone know if this is possible to set up?


Thank you!


Hi @Data_ 


I'm wondering if the US & Canada Drivetime tool (


Or the Non-Overlapping Drivetime tool ( might help.


If I have my spatial data with me, I'll noodle on this and let you know what else might work.





Hi @Data_ 


It sounds like you're trying to do a traveling salesman problem. This community post outlines how I would approach this problem -


Hi @Data_ 


I’ve built out a quick iterative macro (attached) that just starts at the first point, then searches for the next nearest from the remaining points (and so on, and so on…), returning the distance between each point. If you go into the macro you can switch it to drivetimes and your geography, this is just as the crow flies distance for demo, but feel free to change in the drop down of that tool. 









Hopefully it’s a macro that you can just plug your data in to. PS- Very keen to stress that this doesn't aim to solve the Traveling Salesman Problem by the way!

Hope it’s of some help though



Hi @andyuttley ,


Is it possible to iterate this among multiple sets of points?


hi @Data_ 


Yes, with a dummy data set of stores (which are almost in order anyway) you can iterate through a list, and even batch it if you have multiple 'groups' of lists you want to run at the same time. I've switched it to drive times as well in the UK, so you may need to go into the macros to change that depending on your geography!


Here, a Batch macro contains an iterative macro:

Batch macro = all this is doing is feeding the iterative macro (which has our nearest logic in) a set of lists over and over (e.g. set 1 only, then set 2 only etc.)

Iterative macro = this is where the proper logic happens, we just batch first to make sure there's no records being compared from a different list


See below and attached:



(note that you only need the top macro; the bottom one is just to show you the iterative process that's happening inside the top one) 


Hope that helps!



Wow! Thank you @andyuttley !


I'm learning a ton from how you built these out. Thank you for all of your hard work and help guiding me through this!