<< Back

Tableau – Find your closest Competitors

Ever needed to find out which of your competitors are sitting just above or below you in terms of performance? Or maybe see how your competitors are performing and what their closest competitors are?

There’s a relatively straightforward way of doing this in Tableau, we’ll need to create a couple of calculations and parameters first. Here’s how to do it using Superstore, we’ll use the Manufacturer field as your company:

  • Create a Closest Competitors Parameter. This will determine the threshold above and below your company’s performance. I have set mine up per the below screenshot but you can tweak the step size and values to suit the range of values in your own data. Once you have done this, right click on the Parameter and choose ‘Show Parameter Control’. It will then appear to the top right of your screen – at the moment it won’t do anything, we will link it to a calculation later. Also, once on your canvas click the little triangle and change the Parameter interface to ‘Type In’.

  • Create a Manufacturer Parameter – I have set mine up per the below. To populate the list of Manufacturers, choose ‘Add from Field’ and Tableau will bring in all the dimension members from that field as a list. Again, right click the Parameter and Show Parameter Control to bring it next to your canvas.

  • Build a simple Bar Chart – I have SUM([Sales]) on Columns and Manufacturer on Rows:

  • Create a Dynamic Manufacturer calculation – we’re going to use an Exclude Level of Detail Calculation per the below

     { EXCLUDE [Manufacturer]: SUM(IF  [Manufacturer]=[Manufacturer Parameter] THEN [Sales] END)}

  • Next we need to bring together this Dynamic Manufacture calculation and the Closest Competitors Parameter to determine which values to retain in the completed chart. We’re going to create an additional boolean calculation called Closest Manufacturer Filter using the below syntax (you can copy and paste it). This will bring back values above and below the selected manufacturer, which exist within the threshold specified by the Parameter.

SUM([Sales])<= sum([Dynamic Manufacturer]) + [Closest Competitors]

AND

SUM([Sales])>= sum([Dynamic Manufacturer]) – [Closest Competitors]

  • Our final calculation will be one for highlighting the particular Manufacture we choose to focus on, I’ve called this Manufacturer Colour. Again it’s a Boolean calc per the below syntax:
  • [Manufacturer]= [Manufacturer Parameter]

  • Drag Closest Manufacturer Filter to the Filters shelf and select True, you should see the values filter to the closest competitors to your selected Manufacturer.

  • Drag your Manufacturer Colour field to Colour on your Marks Card – be sure to click it and change it to an Attribute otherwise you will see you values filtered only for the selected Manufacturer. Change the colours as you like – it’s best to select a light colour for the competitors and a dark colour for the Manufacturer you are focussing on.

  • Follow this link to a sample workbook on Tableau Public, hope you find it useful!

 

 

 

Luke Stoughton

London, UK

Leave a Reply

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