# Alteryx Designer Discussions

###### ALTER.NEXT:

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!

## Spatial: Tool or process that creates a trade area (polygon) based on a set of rules

Highlighted
6 - Meteoroid

Hello,

I am looking for advice or a tool that will help me with the following analysis below.

I am trying to figure out a way to create a data-driven trade area around our stores. We have consumer data (addresses) that correspond to the store they go and we plot them (centroids) on a map. What I am looking for is a way to create a polygon based on "x" percent of consumers that fall within the smallest area (square miles) possible. I am hoping to have a polyon built around the premise of, for store "x", "x" percent of consumers live within this polygon.

Highlighted
Alteryx Certified Partner

That's a tricky problem.  I can see cases where to the east there is a distant pocket of x% of your customers who live in a high-rise apartment building.  Very dense, you have a minimum square mile trade area.  But to the west you have closer customers.  If you look first by distance, you'll have a larger trade area.  I either see an iterative macro or I see permutations and combinations at play.  Perhaps we can soften the requirements?  If we know that the trade area is already defined or that there is a maximum distance that we can start with, we could divide that polygon into .25 mile square grids.  We could then count the customers within each grid.  At minimum this approach will reduce the problem so that the math will be easier.

Now we have grid cells, their counts and their distance to the store.  We want to achieve a desired count with the fewest grid cells that are the closest to each other.  You would need to calculate the distance from each grid center to every other cell.  I'd try this path and see where you get.  Another option is to ask a pro like @andy_moncla.

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
6 - Meteoroid

@marqueeCrew I don't think density nor distance would affect what I'm looking for; I would just have the name of the store they correspond to within the individual data record. And if there is a denser pocket that accepts my rules that are further away from the store it could be very useful (e.g this is the pocket we pull from, this the demographics of this area, we can expect the similar demographics at new stores, and this could help determine store placement).

Basically I want to weigh our "perceived trade area" to our actual trade area, see similarities and differences, and be more educated about trade area patterns in the future. So I think our current polygon wouldn't be useful.

I will try your approach below, as I have never used the grid tool before.

Thanks for the help

Highlighted
Alteryx Partner

Ryan,

@MarqueeCrew gave you some great advice regarding density and distance.

1. Density impacts distance/drive times.  In other words a store in Manhattan shouldn't have the same rules as Fargo.
2. Distance impacts a customer's willingness to patronize your stores and your competitors' stores.  Customers travel much farther for a Whole Foods or Trader Joe's than they will for a run of the mill grocery store.
3. Your company's attractiveness to different customer segments can/should be considered.  Again, the Trader Joe's vs. a conventional grocery store.  Gravity modelers struggle with the appropriate attractiveness/acceptance scores for Trader Joe's.
4. Consider using a weighted (sales or trips) customer distribution when delineating your trade areas.  A customer with one visit that spends \$100 and lives 20 miles away shouldn't be as meaningful to your business as a customer 3 miles away that spends \$1,200.

You may want to download "What's in a Trade Area?" by Dr. Tony Hernandez, Dr. Tony Lea and Philip Bermingham.  You can find it at https://csca.ryerson.ca/products/whats-in-a-trade-area.  it is free but you will have to join.  Joining is free as well.

Hope @MarqueeCrew and I see you at Inspire.  I'm usually hanging out at the Solutions Center if you want to dig in deeper.

Highlighted
7 - Meteor

(I am going to take a shot at this as I'm working on the same thing)

If you take all your customers for a location, calculate distances from each customer to the store. Sort these by ascending distances and then sample the first 90% (or whatever percent you want). Now you have locations around your store. Pass these through a "Poly-build" and choose Convex Hull as the build method. Now you have a polygon that you can smooth out and get an actual trade area instead of a circle around your store.

I know I'm going to be run into a problem with this because a lot of our locations have overlapping trade areas and I don't have a way to make them non-overlapping.

Let me know how this goes for you. Enjoy.

Labels