Friday, February 19, 2016

Tableau Filled Maps at the City Level

I am working on a filled map showing in gradual colors visitors from each state, but how do I get the map down to more granular scale than just state? Whenever I try to use the city dimension, Tableau pops a warning message saying that the city field can't be used to create the filled maps . Does this mean we need zip code level or some other dimension added in there as well? I've already tried all of the different globe options. 

You can't use City in a filled map because Tableau doesn't have the borders for each city. It does have the lat/long though, so just change your chart type to Circle. Also, adding Country and State to the Detail shelf will help Tableau identify more of the cities. Otherwise you get a lot of Ambiguous city locations.

OK, but once I convert the geo map to circles, there is no relative depth to the shape in terms of its measure (a.k.a one city which has a lot more website sessions doesn't have a different sized/ colored circle than a city with significantly less sessions). Is there an obvious way to make these differences more apparent on this level of detail?
You're right. Although you could add sessions to the color and/or size shelves, maps are best at showing where things happen, not so much their intensity or frequency. You normally end up with a few outliers that throw off the range of values and makes it hard to see most differences. I recommend a combination of charts - perhaps a map at the top and a bar at the bottom. They don't have to be at the same level of detail - you should use actions to filter or highlight selections.

Conditional Color Coding in Tableau

This question came from one of our clients: Several of our clients would like to see conditional color coding and we can't figure out how to make it work consistently. For example, in Excel we have two columns, one for 2015 and one for 2016. We'd like to color code the 2016 column to show whether the value is more or less than the 2015 value. Is there any way to do this? 
That's a great question and is a problem we run into a lot too. You only have two options (three if you count the up/down characters you can put into the Custom Format field).
Tableau assigns colors to each Continuous measure in your visualization - if you use Measure Values, that only counts as one. So you can either color the entire row, or you can create separate worksheets for the colored and non-colored marks and put them on a dashboard together.
Notes:
1) if you have to scroll through your viz, there's no way to synchronize multiple worksheets.
2) If you are using only 1 color (for example red to indicate lower performance), you can use black as your other color which makes it look normal.
I also want to use this color coding system: Green= At or above goal, Yellow = 2% under goal or less, Red= 2%+ under goal. I'm trying to set up custom colors (see attached), but it never lets me get specific enough. 
To do the custom color coding, create a calculated field with IF statements that compares the actual value to the criteria (E.g. 
IF [value] >= [goal] THEN 'Green' 
ELSEIF [value] >=.98*[goal] THEN 'Yellow' 
ELSE 'Red' 
END 

Then assign the appropriate colors to each value.
Now I need help creating the formula to show the difference between two columns. Is there any way to do "2016 values - 2015 values" or something like that? I would make an If/Then calc for 2015 and 2016 and then make a separate calculated field to find the difference, but once I add the 2016 filter it won't work, right?
The best way I've found to do the YoY calculations is using a calculated field called "Relative Year". It's just the difference between the current date and the report date. E.g. DATEDIFF('year', [report date], TODAY()) You should get 0 for the current year, -1 for 1 year back, -2 for 2 years back etc. Then you can make calculated fields for current year, 1 year back, and change this year over last year. It's all dynamic and doesn't require any filters outside the calculated fields.