Showing results for 
Search instead for 
Did you mean: 

Engine Works Blog

Under the hood of Alteryx: tips, tricks and how-tos.

Before I get to today's post, I want to talk a little about Bill's recent post. Polar graphs are not for everyone, but what is really interesting about that post is the technique of using the map tool to make custom charts. He used the map tool in a way that had nothing to do with mapping, it was used exclusively as a rendering engine. Anyway, back to today's topic...


A gravity model is a simple model of the flow of trade from demand (the customers) to the supply (stores). I wanted to make a macro that implements the gravity model to make it easy to reuse. Just to review some simple rules of building macros & wizards: The 1st step when building a macro (or wizard) is to build a standalone module that works - so I spent some time building a module and documenting the module. Once that is done, Figure out the list of questions you want to ask. In my case it was some simple gravity model parameters:



Once you know the questions to ask, identify the tools in the module that need to be changed. It is always a good idea to go into the annotation of each tool you want to change and set a descriptive name (it will make it easier to find later):



Now go into the macro settings and set all the appropriate information into the tools:



Since we named the tool, it is really easy to find in the list. In this case we are updating the Friction of Movement (exponent) value in the formula. Once you have all your actions figured out, you can go ahead and configure your inputs and outputs and you have a pretty easy macro to use. I always like to put a new icon on my macros so I can remember what they do.



Now that the macro is so easy to use, it's really easy and quick to experiment with adding or removing store locations and you can see how it affects your network. Wouldn't it be cool if there was some automated way to do that? Oh well, that will have to wait.


This model is of course very simplistic. We have a whole bunch of companies that use Alteryx to produce MUCH more interesting models than this. I will be trying to put together a list of companies and their specialties that can help people build all kinds of Alteryx modules.


The modules in this post can be found here. Note, this macro requires Alteryx 5.0