<< Back

Looking at the Geographical Skew of Product Sales in Tableau

Firs things first; credits. This idea was generated by my former colleague Will Griffiths, now of Javelin Group, when we were working with an automotive firm to try and understand sales patterns, so full kudos to him.

The use-case centres around the idea that geography, specifically regional geography (north, south, east west), may play an influential role in the sales of our products.

For example, states in the South West of the USA have a very different climate to states in the North West, which could potentially impact the type of products (clothing for example) that sells well in those areas.

The purpose of the visual created by Will is to allow us to understand those geographical patterns, in an easy to consume manner.

Click here to see the interactive visualisation.

So, one thing you will need in your sales data is a latitude and longitude which indicates where the product was sold, this can be a store location for traditional retail, or your customers location for internet retail.

Once we have done this, we can build our chart with just two simple calculations.

The first calculation we have to create is to determine the different between the average selling longitude for each product and the average selling longitude for all our products.

This can be done via a LOD or Table Calculation; I always tend to favour an LOD, so something like…

AVG([Longitude]) – MIN({FIXED : AVG([Longitude])})

will return me a value where, with my product field in the view, any values greater than 0 indicate a skew to the East, and any values with a product longitude less than 0 indicate a skew to the West.

We now need to repeat this for our latitude field, so…

AVG([Latitude]) – MIN({FIXED : AVG([Latitude])})

Once we have both of these calculations it’s then a case of building out our chart, which is essentially a scatter plot, with our ‘Product Longitude’ as our X field and ‘Product Latitude’ as our Y field, before then bringing on our Product field to break the view down.

In the case of our end visualisation shown at the start of this post, I have created one further calculation which uses the ‘Product Latitude’ and ‘Product Longitude’ fields to bucket each of the products into a regional group…

IF [Product Latitude] >0 and [Product Longitude] > 0 THEN “North East”
ELSEIF [Product Latitude] <0 and [Product Longitude] <0 THEN “South West” ELSEIF [Product Latitude] <0 and [Product Longitude] >0 THEN “South East”
ELSE “North West”

And you can also then add a background image of a compass to give people that nudge around what they are viewing.

And voila, we have our compass chart showing the geographical skew of our superstore products.

The final, final thing it is worth adding is a filter on the count of sales for each product, with those that have sold very few times likely to impact the scaling of the view should they have always sold in the same store or customer only.

The workbook can be downloaded here if you want to rip out the calculations, etc 😀


Ben Moss

Leicester, UK

Leave a Reply

Your email address will not be published. Required fields are marked *