Blacking out your map #tableautip

by Soha Elghany

For this map in Tableau, I want to show the top 3 ranked states by region that had the highest amount of profit. For the rest of the states that were ranked below the top 3, I wanted them to be blacked out. This is illustrated in the image below: 

How did I create this?

The first thing I did was group my states into 6 different regions: 

For the selection tools, you’ve got several easy shortcuts, you can use on your keyboard instead of selecting the option that you want. 

  • Rectangular Selection : ‘A’
  • Radial Selection: ‘S’
  • Lasso Selection: ‘D’ 

I ended up group my states into 6 different regions and called my new group ‘Region’

Following this, I dragged ‘States’ into details in the marks card so I can also select individual states within a region. I then put ‘Profit’ in Colour and dragged my ‘Region’ group into details on the marks card.
Now I need to calculate the rank of each state within the region by profit. I did this by creating a calculated field: 

RANK(SUM([Profit]), asc)

The RANK calculated field needs to be changed from continuous to discrete and is then filtered to only include the top 3. After your calculated field is done and you’ve filtered to include the top 3 you should expect to see your map look like this: 

Now you just need to black out the states on the map that are ranked below 3 and this is really simple. 

First, you drag longitudinal in the columns shelf you then click on the drop down option for the longitudinal field you just added in column shelf and select dual axis.  

Go to your first mark card underneath “All” make sure you only have the Region in the details section on the marks field and select black in colour on your marks card. It’s important to do this step in the first mark card because this is will make sure your grouped Region is the first layer on your map. 

For your second mark card in the longitudinal field make sure you still have: Region and States in details and Profit in colour. This will make sure that the states that have no rank are ‘blacked out’ and when you select a State that has no rank the whole region gets coloured in black as shown in the image below:

  

vs.

When you select a State that ranks in the top 3 when its selected you should see this: 

 

As you can notice when you select a States that ranks in the top 3 in Profit it highlights only the selected States, however when you select a State that has no rank it highlights the whole region.